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 1mfQ2N-0003ZV-Jv for pgsql-general@arkaria.postgresql.org; Tue, 26 Oct 2021 17:14:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mfQ2M-0004Uh-H6 for pgsql-general@arkaria.postgresql.org; Tue, 26 Oct 2021 17:14:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mfQ2M-0004UY-4z for pgsql-general@lists.postgresql.org; Tue, 26 Oct 2021 17:14:58 +0000 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mfQ2K-00052c-23 for pgsql-general@lists.postgresql.org; Tue, 26 Oct 2021 17:14:57 +0000 Received: by mail-ot1-x330.google.com with SMTP id y15-20020a9d460f000000b0055337e17a55so20761158ote.10 for ; Tue, 26 Oct 2021 10:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=WukOZNpOYf5Z7XSdwnN07XpnZ4xGCtQozV/Oh3riOCg=; b=jJ7Y+MwEBqHkQTvEW0AWZZUT9ZYtLVl/0Ls4Mu+rAf0GCqVHVdk3qqIP9c81hMhgeZ wDLBmfY3LtuxMLygXb8twT8ogV3Hyy8iIHAFx4hrmlFSF3c36BcDaM04zpXtXQLMB5kK MCxch0ykq7BCP+jJNYvAqpEMAbd3VCgFX/V+mQ6+iZ4v20Sqbbz1o7n9Igmn3aQp2Urk 7XuGZnNEX6NBnOMBSCr12y/UTTqZZ609sBtiZJXmXkMKQGI+44N0ocIRqfuY4mv6j1kx 0Y5vQ6sU6QweYPrLt1zm8ahYWSAAwMIDvJe4fbKckS+cjzlodXLUeyjH7LUZRJRFPBRD m0TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=WukOZNpOYf5Z7XSdwnN07XpnZ4xGCtQozV/Oh3riOCg=; b=M15PCLW/QwRAlW7YGtAjECY6hjWvNWBr00/sIEIgG2TqLC33m1Vt45POoGRjHJt35k hr3zVGHEx8c3rFCEzvw++f4GAd+QjCXMdQgzcRgY2trZN5ST/YJ+ipocDWXfmIebXCAv iEQDnstWL+mdR9Wp5t/AYqZ71oUAwtLRX2nJH2MUcIgXIF+46qeIUCpdSy4TprC9CE4K NPl0+LBdhv/lZnfWS3Ef6FxsE3udTT3B8DHd0QjpVSY7LjnjAqCAzVa44lFBRYTg4CwC Ch82QxVtjBkegBPRqcgnFSsEpwOTnn+GwqaReHVWL+cx0ZwlQGy3PTveYyAeAUy5zx9F DpbQ== X-Gm-Message-State: AOAM531W4ztqPcG/SPMLmYOfQ6W5jenQU2zpkuhlDBtKIEI6ff8eouRG R9K5gvDU1eKdzc/GzzK5TBrHK7hPWhk= X-Google-Smtp-Source: ABdhPJyuYWHnpc/8sxSoTIfLny+eA5w9cGlxkBvsAs2hBBe2V/qNQQJVqcHSQTP09XlhJV1VXfe6Fw== X-Received: by 2002:a9d:458d:: with SMTP id x13mr19997376ote.290.1635268494860; Tue, 26 Oct 2021 10:14:54 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id b13sm1506346ooo.20.2021.10.26.10.14.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Oct 2021 10:14:54 -0700 (PDT) Subject: Re: Need help understanding error message To: pgsql-general@lists.postgresql.org References: <9532af10-68ce-9687-1256-a858b248b755@appl-ecosys.com> From: Ron Message-ID: <6778e953-287e-2a5a-3281-a5671b76608d@gmail.com> Date: Tue, 26 Oct 2021 12:14:53 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <9532af10-68ce-9687-1256-a858b248b755@appl-ecosys.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/26/21 11:58 AM, Rich Shepard wrote: > 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, Show us the actual UPDATE statement. -- Angular momentum makes the world go 'round.