Re: Ris: BUG #15482: Foreign keys to a partition (NOT A PARTITIONED)break the server - Mailing list pgsql-bugs

From Ing. Gianluca Alberici
Subject Re: Ris: BUG #15482: Foreign keys to a partition (NOT A PARTITIONED)break the server
Date
Msg-id aa26c31c-bacd-d21e-8325-503e39a1c723@abinetworks.biz
Whole thread Raw
In response to Re: Ris: BUG #15482: Foreign keys to a partition (NOT A PARTITIONED)break the server  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Ris: BUG #15482: Foreign keys to a partition (NOT A PARTITIONED) break the server  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs

Alvaro,

Actually it is a strange behavior, look at this:

abi2=> begin;
BEGIN
abi2=> delete from _abi_main_pof_t where poftid=1843635;
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> \q
root@wnet0:~# psql -Uphoebe abi2 -p5433
psql (11.0 (Debian 11.0-1.pgdg90+2))
Type "help" for help.

abi2=> vacuum full analyze _abi_main_pof_t;
VACUUM
abi2=> vacuum full analyze _abi_main_pof_r;
VACUUM
abi2=> begin;
BEGIN
abi2=> delete from _abi_main_pof_t where poftid=1843635;
ERROR:  update or delete on table "_abi_main_pof_t" violates foreign key constraint "_abi_main_pof_t_refid_fkey" on table "_abi_main_pof_t"
DETAIL:  Key (poftid)=(1843635) is still referenced from table "_abi_main_pof_t".
abi2=>

Now, these two tables were originally normal tables with huge data in it.

They were added a pi (partition index) field to be child of a master partitioned by range.

A master table were created and a 'brother' table too to host 'unused records'.

Tables were put toghether and by updating pi's records were moved around child tables.

This were done by removing triggers and fk's to speed up moving process.

Then keys and triggers were rebuilt and the problem arised.

After vacuuming as you can see...

I will repeat the whole 'migration' process the next days and see if it happens again. If you want i can set up a user account on this machine to play with this better than i could.

I think it could be useful to investigate the overall stability of the server.

Let me know if youre interested in it.

Best Regards,

G

pgsql-bugs by date:

Previous
From: Andriy Bartash
Date:
Subject: Update on bug #15468
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #15437: Segfault during insert into declarative partitionedtable with a trigger creating partition