Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mfPvK-0003NC-CS for pgsql-general@arkaria.postgresql.org; Tue, 26 Oct 2021 17:07:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mfPvI-0007Te-As for pgsql-general@arkaria.postgresql.org; Tue, 26 Oct 2021 17:07:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mfPvH-0007TU-Te for pgsql-general@lists.postgresql.org; Tue, 26 Oct 2021 17:07:40 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mfPvF-0000eh-M6 for pgsql-general@lists.postgresql.org; Tue, 26 Oct 2021 17:07:39 +0000 Received: by mail-pg1-x531.google.com with SMTP id q187so146643pgq.2 for ; Tue, 26 Oct 2021 10:07:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ZDcU++XiUgn7RwVEHMB8sw/+WO/as0U8q/mYaJl5TJ0=; b=omYY83zDXf3S3KWoY9BGLAYyCtdSjcXB6KmCgZi+0lYBARmL4qWBmfdLFFNyyNcfVp 9aVsyBvwTPp1/YhHvyphQDpxWvviELKsCp992TDQzwYWxFhdQ6rxxdgHk1e7KI7MbKo+ JIFUwDegbLU5riJGNAcaIHcQiBiviD+JPZkmX7X6IO4TG0alGx2X4/xnCQNDswxyNgxm 6ETuXOS5dq6BiN7I71ksiaS5O9Tv7GaTxyoI6/v7QxymD6ptVGklMhlmbBV6wnsb4DdY SDlFdSvEHtyTqnbkrx3RzlEw9uF8E6wsChexItkuS4T58jUXTi6q6TaoeOlec5vAZ5l3 EILA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ZDcU++XiUgn7RwVEHMB8sw/+WO/as0U8q/mYaJl5TJ0=; b=g7jgPbz7SVrST7QeAa0cuLoLtaxllG8+7kmx/v8iDA2BFsQmCXzrFn0zuOTQnExzLP Ddhwz7LSgR1e/TuUO6n6vp4oYyB4BQGd+S7C7mh545gAhhXWeVB7k7Iz1ac5MraAFcqs MCI/ynNbkS91utYR+k2kU1kTwGf7c14yW+sp1gT2sdWgk4zUC2TkkMsQWDqdarXkdFsR Q2tW+cEF6Dil9wCKkw7YXJ1z1ta4QyKdnll0qwvf3Ia6eoZrnROOU8gqc/iKQkvrTzYP NfcowWe0woDX06jyDUUGCc6l9vq84RMjPddf1TrdVDyFY/1kP+OhMEG7XnYaebCN9+4n TlgA== X-Gm-Message-State: AOAM5310Z3xFPcUjoBsWr6ODzLm+IQ0v4yen5AJCxHb59W47PP/bNPH5 /5esQDlI2zUszoh4wGRon0H5ud+V7k0= X-Google-Smtp-Source: ABdhPJxeQInmeowcCykUJLIcns39MgAFDvRXk8PtNhK3ajIGHUMLXl9PpwnNKhV8BIgdSFI6wcq4BA== X-Received: by 2002:a05:6a00:21c4:b0:475:e532:3d18 with SMTP id t4-20020a056a0021c400b00475e5323d18mr27241142pfj.40.1635268055117; Tue, 26 Oct 2021 10:07:35 -0700 (PDT) Received: from smtpclient.apple ([155.98.131.1]) by smtp.gmail.com with ESMTPSA id g5sm15533237pfc.65.2021.10.26.10.07.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Oct 2021 10:07:34 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: Need help understanding error message From: Rob Sargent In-Reply-To: <9532af10-68ce-9687-1256-a858b248b755@appl-ecosys.com> Date: Tue, 26 Oct 2021 10:07:32 -0700 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <43BD2E36-42A3-4D2E-BBAC-0C6355B9647E@gmail.com> References: <9532af10-68ce-9687-1256-a858b248b755@appl-ecosys.com> To: Rich Shepard X-Mailer: Apple Mail (2.3654.120.0.1.13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Oct 26, 2021, at 9:58 AM, Rich Shepard = wrote: >=20 > In a database table I have these rows: > # select * from contacts where person_nbr=3D6; > person_nbr | contact_date | contact_type | = not > es | = next_contact = ------------+--------------+--------------+-------------------------------= -------------------------- > = ---------------------------------------------------------+-------------- > 6 | 2018-04-05 | Phone | Left message @ 9:39. > | > 6 | 2019-05-14 | Phone | He can call me if issues do = come up. | > 6 | 2021-08-17 | Email | Sent message 2. > | 2021-10-06 > 6 | 2021-07-23 | Email | Sent message 1. > | 2021-07-28 > 6 | 2021-07-28 | Email | Sent message 1. > | 2021-08-16 > (5 rows) >=20 > When I try to update this table with: > (6,'2021-10-26','Email','message 3','2012-11-16'), > psql reports this error: > psql:insert_into_contacts.sql:31: ERROR: duplicate key value violates = unique constraint "activities_pkey" > DETAIL: Key (person_nbr, contact_date, contact_type)=3D(6, = 2021-10-26, Email) already exists. >=20 > The PK for this table is: > PRIMARY KEY, btree (person_nbr, contact_date, contact_type) > so there should be no conflict as the contact_date in the update is = not > already in the table. >=20 > I don't understand the error as it's not occurred before when updating = this > table. >=20 > Insight needed, >=20 > Rich >=20 >=20 What do you get when you select * where person_nbr =3D 6 and = contact_date =3D =E2=80=982021-10-26=E2=80=99 and contact_type =3D = =E2=80=98Email=E2=80=99 from activities; ?