pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedNeed help understanding error message
9+ messages / 3 participants
[nested] [flat]
* Need help understanding error message
@ 2021-10-26 16:58 Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:07 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
2021-10-26 17:14 ` Re: Need help understanding error message Ron <ronljohnsonjr@gmail.com>
0 siblings, 2 replies; 9+ messages in thread
From: Rich Shepard @ 2021-10-26 16:58 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Need help understanding error message
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
@ 2021-10-26 17:07 ` Rob Sargent <robjsargent@gmail.com>
2021-10-26 18:00 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
2021-10-26 18:05 ` Re: Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
1 sibling, 2 replies; 9+ messages in thread
From: Rob Sargent @ 2021-10-26 17:07 UTC (permalink / raw)
To: Rich Shepard <rshepard@appl-ecosys.com>; +Cc: pgsql-general@lists.postgresql.org
> On Oct 26, 2021, at 9:58 AM, Rich Shepard <rshepard@appl-ecosys.com> 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,
>
> Rich
>
>
What do you get when you select * where person_nbr = 6 and contact_date = ‘2021-10-26’ and contact_type = ‘Email’ from activities; ?
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Need help understanding error message
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:07 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
@ 2021-10-26 18:00 ` Rob Sargent <robjsargent@gmail.com>
1 sibling, 0 replies; 9+ messages in thread
From: Rob Sargent @ 2021-10-26 18:00 UTC (permalink / raw)
To: Rich Shepard <rshepard@appl-ecosys.com>; +Cc: pgsql-general@lists.postgresql.org
> On Oct 26, 2021, at 10:07 AM, Rob Sargent <robjsargent@gmail.com> wrote:
>
>
>
>>
> What do you get when you select * where person_nbr = 6 and contact_date = ‘2021-10-26’ and contact_type = ‘Email’ from activities; ?
>
>
>
Whoa. Not sure why I put the “from” last but I’m sure you know it goes before the “where”.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Need help understanding error message
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:07 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
@ 2021-10-26 18:05 ` Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 18:14 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
1 sibling, 1 reply; 9+ messages in thread
From: Rich Shepard @ 2021-10-26 18:05 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Tue, 26 Oct 2021, Rob Sargent wrote:
> What do you get when you select * where person_nbr = 6 and contact_date =
> ‘2021-10-26’ and contact_type = ‘Email’ from activities; ?
Rob,
<where person_nbr = 6 and contact_date = '2021-10-26' and contact_type = 'Email';
person_nbr | contact_date | contact_type | notes | next_contact
------------+--------------+--------------+-------+--------------
(0 rows)
Rich
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Need help understanding error message
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:07 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
2021-10-26 18:05 ` Re: Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
@ 2021-10-26 18:14 ` Rob Sargent <robjsargent@gmail.com>
2021-10-26 18:16 ` Re: Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
0 siblings, 1 reply; 9+ messages in thread
From: Rob Sargent @ 2021-10-26 18:14 UTC (permalink / raw)
To: Rich Shepard <rshepard@appl-ecosys.com>; +Cc: pgsql-general@lists.postgresql.org
> On Oct 26, 2021, at 11:05 AM, Rich Shepard <rshepard@appl-ecosys.com> wrote:
>
> On Tue, 26 Oct 2021, Rob Sargent wrote:
>
>> What do you get when you select * where person_nbr = 6 and contact_date =
>> ‘2021-10-26’ and contact_type = ‘Email’ from activities; ?
>
> Rob,
>
> <where person_nbr = 6 and contact_date = '2021-10-26' and contact_type = 'Email';
> person_nbr | contact_date | contact_type | notes | next_contact ------------+--------------+--------------+-------+--------------
> (0 rows)
>
> Rich
>
Are you doing a batch of updates, and including/generating a duplicate in there?
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Need help understanding error message
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:07 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
2021-10-26 18:05 ` Re: Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 18:14 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
@ 2021-10-26 18:16 ` Rich Shepard <rshepard@appl-ecosys.com>
0 siblings, 0 replies; 9+ messages in thread
From: Rich Shepard @ 2021-10-26 18:16 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Tue, 26 Oct 2021, Rob Sargent wrote:
> Are you doing a batch of updates,
Yes,
> ... and including/generating a duplicate in there?
No.
Rich
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Need help understanding error message
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
@ 2021-10-26 17:14 ` Ron <ronljohnsonjr@gmail.com>
2021-10-26 18:06 ` Re: Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
1 sibling, 1 reply; 9+ messages in thread
From: Ron @ 2021-10-26 17:14 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Need help understanding error message
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:14 ` Re: Need help understanding error message Ron <ronljohnsonjr@gmail.com>
@ 2021-10-26 18:06 ` Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 18:15 ` Re: Need help understanding error message Rob Sargent <robjsargent@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Rich Shepard @ 2021-10-26 18:06 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Tue, 26 Oct 2021, Ron wrote:
> Show us the actual UPDATE statement.
Ron,
insert into contacts (person_nbr,contact_date,contact_type,notes,next_contact) values
(1,'2021-10-26','Email','message 3','2012-11-16'),
(4,'2021-10-26','Email','message 3','2012-11-16'),
(6,'2021-10-26','Email','message 3','2012-11-16'),
(3,'2021-10-26','Email','message 3','2012-11-16'),
(6,'2021-10-26','Email','message 3','2012-11-16'),
...
);
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Need help understanding error message
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:14 ` Re: Need help understanding error message Ron <ronljohnsonjr@gmail.com>
2021-10-26 18:06 ` Re: Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
@ 2021-10-26 18:15 ` Rob Sargent <robjsargent@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: Rob Sargent @ 2021-10-26 18:15 UTC (permalink / raw)
To: Rich Shepard <rshepard@appl-ecosys.com>; +Cc: pgsql-general@lists.postgresql.org
> On Oct 26, 2021, at 11:06 AM, Rich Shepard <rshepard@appl-ecosys.com> wrote:
>
> On Tue, 26 Oct 2021, Ron wrote:
>
>> Show us the actual UPDATE statement.
>
> Ron,
>
> insert into contacts (person_nbr,contact_date,contact_type,notes,next_contact) values
> (1,'2021-10-26','Email','message 3','2012-11-16'),
> (4,'2021-10-26','Email','message 3','2012-11-16'),
> (6,'2021-10-26','Email','message 3','2012-11-16'),
> (3,'2021-10-26','Email','message 3','2012-11-16'),
> (6,'2021-10-26','Email','message 3','2012-11-16'),
> ...
> );
>
Aren’t lines 3 and 6 duplicates?
>
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2021-10-26 18:16 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 16:58 Need help understanding error message Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:07 ` Rob Sargent <robjsargent@gmail.com>
2021-10-26 18:00 ` Rob Sargent <robjsargent@gmail.com>
2021-10-26 18:05 ` Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 18:14 ` Rob Sargent <robjsargent@gmail.com>
2021-10-26 18:16 ` Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 17:14 ` Ron <ronljohnsonjr@gmail.com>
2021-10-26 18:06 ` Rich Shepard <rshepard@appl-ecosys.com>
2021-10-26 18:15 ` Rob Sargent <robjsargent@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox