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 1mfPmC-00031M-8b for pgsql-general@arkaria.postgresql.org; Tue, 26 Oct 2021 16:58:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mfPmB-0001i1-2d for pgsql-general@arkaria.postgresql.org; Tue, 26 Oct 2021 16:58:15 +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 1mfPmA-0001bm-OU for pgsql-general@lists.postgresql.org; Tue, 26 Oct 2021 16:58:14 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mfPm5-0000ax-EO for pgsql-general@lists.postgresql.org; Tue, 26 Oct 2021 16:58:14 +0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id C8B372A0108 for ; Tue, 26 Oct 2021 09:58:06 -0700 (PDT) Date: Tue, 26 Oct 2021 09:58:06 -0700 (PDT) From: Rich Shepard Reply-To: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Need help understanding error message Message-ID: <9532af10-68ce-9687-1256-a858b248b755@appl-ecosys.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk In a database table I have these rows: # select * from contacts where person_nbr=6; 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) 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)=(6, 2021-10-26, Email) already exists. 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. I don't understand the error as it's not occurred before when updating this table. Insight needed, Rich