On 2024-07-15 10:04:39 -0400, Ron Johnson wrote: > The job does DELETE FROM rel_group_user; (no WHERE clause!!) then does DELETE > FROM public.access_user; (also no WHERE clause), but the public.access_user > statement fails on FK constraint error on rel_group_user (which was just > recently emptied). > > Each statement is in a different transaction, since they are executed via > separate psql statements. Thus, no apparent MVCC visibility weirdness. > > My first thought, of course, was that there are two rel_group_user tables. > Alas, no, there's just one. See below for grep statement. > > Excerpts from the cron job log file: > [snip] > 2024-07-15 02:40:04 Deleting from FISPTAPPGS401DA/TAPd.rel_group_user > DELETE FROM rel_group_user; > DELETE 42747 > [snip] > 2024-07-15 02:41:15 Deleting from FISPTAPPGS401DA/TAPd.public.access_user > DELETE FROM public.access_user; > ERROR: update or delete on table "access_user" violates foreign key constraint > "fk_rel_group_user_1" on table "rel_group_user" > DETAIL: Key (user_id)=(1210) is still referenced from table "rel_group_user". > ERROR: deleting FISPTAPPGS401DA/TAPd.public.access_user > [snip] Is it possible that some other process created an entry in rel_group_user between these two queries? hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@xxxxxx | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
Attachment:
signature.asc
Description: PGP signature