Re: How does this FK constraint error happen?

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How does this FK constraint error happen?
Date: 2024-07-15 14:53:46
Message-ID: CANzqJaCZkwRon9xDOeFaTd05KZM--Eei1SAiattJXurx_8n0bQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 15, 2024 at 10:35 AM Peter J. Holzer <hjp-pgsql(at)hjp(dot)at> wrote:
[snip]

>
> Is it possible that some other process created an entry in
> rel_group_user between these two queries?

That was, in fact, the problem. At just the wrong time to impact one of
the child databases (TAPd), but not the other two (TAPb and TAPc).

TAPd=# select * from rel_group_user
where user_id between 1100 and 1300
order by user_id;
user_id | group_id | modified_by | modified_on
---------+----------+-------------+-------------------------
1133 | 2 | 1133 | 2024-07-15 08:43:35.669
1142 | 2 | 1142 | 2024-07-15 09:05:58.451
1147 | 2 | 1147 | 2024-07-15 09:30:37.169
1158 | 2 | 1158 | 2024-07-15 09:36:45.142
1197 | 2 | 1197 | 2024-07-15 09:52:58.477
1210 | 2 | 1210 | 2024-07-15 02:42:09.355 <<<<<<<<<<<<<
1229 | 2 | 1229 | 2024-07-15 08:33:48.443
1242 | 2 | 1242 | 2024-07-15 10:29:51.176
1260 | 2 | 1260 | 2024-07-15 07:36:21.182
1283 | 2 | 1283 | 2024-07-15 09:48:25.214
1288 | 2 | 1288 | 2024-07-15 08:10:33.609
(11 rows)

TAPd=# select user_id, login_id, created_on, modified_on
TAPd-# from public.access_user
TAPd-# where user_id = 1210;
user_id | login_id | created_on | modified_on
---------+------------+-------------------------+-------------------------
1210 | JORIEUSER3 | 2023-10-20 11:54:24.562 | 2024-07-15 02:42:09.355
(1 row)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-07-15 15:06:02 Re: How does this FK constraint error happen?
Previous Message Shenavai, Manuel 2024-07-15 14:42:41 Monitoring DB size