Re: Ris: BUG #15482: Foreign keys to a partition (NOT A PARTITIONED) break the server

From: "Ing(dot) Gianluca Alberici" <alberici(at)abinetworks(dot)biz>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Ris: BUG #15482: Foreign keys to a partition (NOT A PARTITIONED) break the server
Date: 2018-11-05 19:10:43
Message-ID: aa26c31c-bacd-d21e-8325-503e39a1c723@abinetworks.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2018-11-05 19:23:05 Re: BUG #15437: Segfault during insert into declarative partitioned table with a trigger creating partition
Previous Message Andriy Bartash 2018-11-05 18:17:21 Update on bug #15468