Re: Multi-insert into a partitioned table with before insert row trigger causes server crash on latest HEAD

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: peter_e(at)gmx(dot)net, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, david(dot)rowley(at)2ndquadrant(dot)com, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Subject: Re: Multi-insert into a partitioned table with before insert row trigger causes server crash on latest HEAD
Date: 2018-10-16 04:33:55
Message-ID: CAE9k0P=m0JVPc+vFHaRn83fP32EP=Es44trkapqw=_c1qz011g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Yea, that anlysis sounds right. Peter?
>
Thanks Andres for the confirmation on my initial analysis. I'm not
sure why Peter hasn't commented on it so far. However, I continued
investigating on it further and here are findings

I think, the root cause of this problem is that CopyFrom() is using
the stale value of *has_before_insert_row_trig* to determine if the
current partition is okay for multi-insert or not i.e.
has_before_insert_row_trig used to determine multi-insert condition
for the current partition actually belongs to old partition. I think,
*has_before_insert_row_trig* needs to updated before CopyFrom()
evaluates if the current partition is good to go for multi insert or
not. Attached is the patch based on this. I've also added the relevant
test-case for it. Peter, David, Could you please have a look into the
attached patch and share your thoughts. Thank you.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

Attachment Content-Type Size
use-updated-trigger-flag-for-multi-insert-partitioned-tab.patch text/x-patch 3.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-10-16 04:50:51 Re: Large writable variables
Previous Message Andres Freund 2018-10-16 04:12:40 Re: Large writable variables