Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-08 Thread Arthur Zakirov
Hello, On 10/6/18 7:50 PM, Alvaro Herrera wrote: here's my proposed patch. There is an incorrect assert condition within EventTriggerCollectAlterTableSubcmd(). Maybe it should be like this? - Assert(OidIsValid(currentEventTriggerState->currentCommand)); +

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-06 Thread Michael Paquier
On Sat, Oct 06, 2018 at 09:32:02PM -0300, Alvaro Herrera wrote: > On 2018-Oct-06, Alvaro Herrera wrote: >> here's my proposed patch. > > Pushed a few hours ago. Thanks, Alvaro. -- Michael signature.asc Description: PGP signature

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-06 Thread Alvaro Herrera
On 2018-Oct-06, Alvaro Herrera wrote: > here's my proposed patch. Pushed a few hours ago. -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-06 Thread Alvaro Herrera
here's my proposed patch. -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services >From 50f049f30875fd6fa9b8b3346c9da176725f37ff Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Sat, 6 Oct 2018 12:53:01 -0300

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-05 Thread Alvaro Herrera
On 2018-Oct-06, Michael Paquier wrote: > On Fri, Oct 05, 2018 at 04:04:02PM -0400, Tom Lane wrote: > > Alvaro Herrera writes: > >> On 2018-Oct-04, Tom Lane wrote: > >>> Not sure about that. Alvaro seems to think there's a generic problem > >>> in event trigger processing, which if true, was

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-05 Thread Michael Paquier
On Fri, Oct 05, 2018 at 04:04:02PM -0400, Tom Lane wrote: > Alvaro Herrera writes: >> On 2018-Oct-04, Tom Lane wrote: >>> Not sure about that. Alvaro seems to think there's a generic problem >>> in event trigger processing, which if true, was likely there pre-v11. > >> After sleeping on this, I

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-05 Thread Tom Lane
Alvaro Herrera writes: > On 2018-Oct-04, Tom Lane wrote: >> Not sure about that. Alvaro seems to think there's a generic problem >> in event trigger processing, which if true, was likely there pre-v11. > After sleeping on this, I think that a better answer is to fix the crash > per Michael's

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-05 Thread Alvaro Herrera
On 2018-Oct-04, Tom Lane wrote: > "Jonathan S. Katz" writes: > > On 10/4/18 8:34 PM, Michael Paquier wrote: > >> I am suggesting to fix the issue after RC1 is released, but before GA. > > > That approach would mean we would require an RC2, which would further > > delay the GA. > > Not sure

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-05 Thread Jonathan S. Katz
On 10/5/18 3:35 PM, Andres Freund wrote: > Hi, > > On 2018-10-05 15:31:37 -0400, Jonathan S. Katz wrote: >> On 10/4/18 11:37 PM, Tom Lane wrote: >>> "Jonathan S. Katz" writes: On 10/4/18 8:34 PM, Michael Paquier wrote: > I am suggesting to fix the issue after RC1 is released, but before

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-05 Thread Andres Freund
Hi, On 2018-10-05 15:31:37 -0400, Jonathan S. Katz wrote: > On 10/4/18 11:37 PM, Tom Lane wrote: > > "Jonathan S. Katz" writes: > >> On 10/4/18 8:34 PM, Michael Paquier wrote: > >>> I am suggesting to fix the issue after RC1 is released, but before GA. > > > >> That approach would mean we would

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-05 Thread Jonathan S. Katz
On 10/4/18 11:37 PM, Tom Lane wrote: > "Jonathan S. Katz" writes: >> On 10/4/18 8:34 PM, Michael Paquier wrote: >>> I am suggesting to fix the issue after RC1 is released, but before GA. > >> That approach would mean we would require an RC2, which would further >> delay the GA. > > Not sure

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Tom Lane
"Jonathan S. Katz" writes: > On 10/4/18 8:34 PM, Michael Paquier wrote: >> I am suggesting to fix the issue after RC1 is released, but before GA. > That approach would mean we would require an RC2, which would further > delay the GA. Not sure about that. Alvaro seems to think there's a generic

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Jonathan S. Katz
On 10/4/18 8:34 PM, Michael Paquier wrote: > On Thu, Oct 04, 2018 at 04:54:45PM -0700, Andres Freund wrote: >> Are you suggesting we fix after RC1, or delay RC1? I'm not 100% sure >> I'm parsing your sentence correctly. > > I am suggesting to fix the issue after RC1 is released, but before GA.

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Michael Paquier
On Thu, Oct 04, 2018 at 04:54:45PM -0700, Andres Freund wrote: > Are you suggesting we fix after RC1, or delay RC1? I'm not 100% sure > I'm parsing your sentence correctly. I am suggesting to fix the issue after RC1 is released, but before GA. -- Michael signature.asc Description: PGP

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Andres Freund
Hi, On 2018-10-05 08:29:29 +0900, Michael Paquier wrote: > On Thu, Oct 04, 2018 at 06:04:49PM -0400, Tom Lane wrote: > > Alvaro Herrera writes: > >> I'm tied up in something else at the moment so can't spend more time on > >> it, but I hope to have time to give it a look over the weekend. > > >

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Michael Paquier
On Thu, Oct 04, 2018 at 06:04:49PM -0400, Tom Lane wrote: > Alvaro Herrera writes: >> I'm tied up in something else at the moment so can't spend more time on >> it, but I hope to have time to give it a look over the weekend. > > Keep in mind that RC1 is scheduled to wrap Monday afternoon ...

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Tom Lane
Alvaro Herrera writes: > I'm tied up in something else at the moment so can't spend more time on > it, but I hope to have time to give it a look over the weekend. Keep in mind that RC1 is scheduled to wrap Monday afternoon ... regards, tom lane

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Alvaro Herrera
On 2018-Oct-03, Michael Paquier wrote: > Okay. I have spent more time on this issue, and I have been able to > integrate a test in the existing event_trigger.sql which is able to > reproduce the reported failure. Attached is what I am finishing with. > > I still want to do more testing on it,

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Alvaro Herrera
On 2018-Oct-04, Alvaro Herrera wrote: > I admit I'm surprised that your patch fixes the bug. sql_drop was added > before the command-stashing was added for pg_event_trigger_ddl_commands > was added, and sql_drop only processes objects from the list passed to > performMultipleDeletions, so adding

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Dmitry Dolgov
> On Wed, 3 Oct 2018 at 09:53, Michael Paquier wrote: > > On Fri, Sep 28, 2018 at 12:17:00PM +0900, Michael Paquier wrote: > > I think that Alvaro should definitely look at this patch to be sure, or > > I could do it, but I would need to spend way more time on this and check > > event trigger

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-04 Thread Alvaro Herrera
I admit I'm surprised that your patch fixes the bug. sql_drop was added before the command-stashing was added for pg_event_trigger_ddl_commands was added, and sql_drop only processes objects from the list passed to performMultipleDeletions, so adding the EventTriggerAlterTableStart() / End()

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-10-03 Thread Michael Paquier
On Fri, Sep 28, 2018 at 12:17:00PM +0900, Michael Paquier wrote: > I think that Alvaro should definitely look at this patch to be sure, or > I could do it, but I would need to spend way more time on this and check > event trigger interactions. > > Anyway, I was struggling a bit regarding the

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-09-27 Thread Michael Paquier
On Thu, Sep 27, 2018 at 11:02:06PM +0200, Dmitry Dolgov wrote: > Yes, you're right. Although probably it's not great that the sequence of > EventTriggerAlterTableStart, EventTriggerAlterTableRelid and > EventTriggerAlterTableEnd is distributed between different functions (which > most likely is

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-09-27 Thread Dmitry Dolgov
> On Wed, 26 Sep 2018 at 05:33, Michael Paquier wrote: > > On Tue, Sep 25, 2018 at 01:39:59PM +0200, Dmitry Dolgov wrote: > > Shouldn't it be fixed by adding EventTriggerAlterTableStart? Judging from > > the > > following call of ATController, we can just pass NULL as parsetree. > > Hmm. I

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-09-25 Thread Michael Paquier
On Tue, Sep 25, 2018 at 01:39:59PM +0200, Dmitry Dolgov wrote: > Shouldn't it be fixed by adding EventTriggerAlterTableStart? Judging from the > following call of ATController, we can just pass NULL as parsetree. Hmm. I don't think that this is correct as this data could always be used to fetch

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-09-25 Thread Dmitry Dolgov
> On Mon, 24 Sep 2018 at 17:58, Alvaro Herrera wrote: > > On 2018-Sep-20, Marco Slot wrote: > > > We're seeing a segmentation fault when creating a partition of a > > partitioned table with a primary key when there is a sql_drop trigger on > > Postgres 11beta4. > > > > We discovered it because

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-09-24 Thread Alvaro Herrera
On 2018-Sep-20, Marco Slot wrote: > We're seeing a segmentation fault when creating a partition of a > partitioned table with a primary key when there is a sql_drop trigger on > Postgres 11beta4. > > We discovered it because the Citus extension creates a sql_drop trigger, > but it's otherwise

Re: Segfault when creating partition with a primary key and sql_drop trigger exists

2018-09-24 Thread Justin Pryzby
On Thu, Sep 20, 2018 at 12:00:18PM +0200, Marco Slot wrote: > We're seeing a segmentation fault when creating a partition of a > partitioned table with a primary key when there is a sql_drop trigger on > Postgres 11beta4. Thanks for reporting ; I reproduced easily so added to open items list,

Segfault when creating partition with a primary key and sql_drop trigger exists

2018-09-20 Thread Marco Slot
We're seeing a segmentation fault when creating a partition of a partitioned table with a primary key when there is a sql_drop trigger on Postgres 11beta4. We discovered it because the Citus extension creates a sql_drop trigger, but it's otherwise unrelated to the Citus extension: