Re: ALTER TABLE ... NOREWRITE option - Mailing list pgsql-hackers

From Andres Freund
Subject Re: ALTER TABLE ... NOREWRITE option
Date
Msg-id 20121206194341.GA31249@awork2.anarazel.de
Whole thread Raw
In response to Re: ALTER TABLE ... NOREWRITE option  ("Petr Jelinek" <pjmodos@pjmodos.net>)
Responses Re: ALTER TABLE ... NOREWRITE option  ("Petr Jelinek" <pjmodos@pjmodos.net>)
List pgsql-hackers
On 2012-12-06 20:27:33 +0100, Petr Jelinek wrote:
> > -----Original Message-----
> > From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-
> > owner@postgresql.org] On Behalf Of Andres Freund
> > Sent: 06 December 2012 20:04
> > To: Simon Riggs
> > Cc: Robert Haas; Dimitri Fontaine; Josh Berkus;
> pgsql-hackers@postgresql.org
> > Subject: Re: [HACKERS] ALTER TABLE ... NOREWRITE option
> > > I don't see any difference between an event trigger and these
> > statements...
> > >
> > > BEGIN;
> > > ALTER TABLE x ...;
> > > SELECT somefunction();
> > > ALTER TABLE y ...;
> > > COMMIT;
> >
> > Event triggers get called *during* the ALTER TABLE. So if were not careful
> > they see something thats not easy to handle.
> >
>
> I thought the point of this was to call the trigger *before* anything
> happens.

Just because the rewrite hasn't started yet, doesn't mean nothing else
has been changed.

Note, I am not saying this is impossible or anything, the original point
drawn into question was that we need to be especially careful with
choosing callsites and thats its not trivial to do right.

Greetings,

Andres Freund

--Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: "Petr Jelinek"
Date:
Subject: Re: ALTER TABLE ... NOREWRITE option
Next
From: "Petr Jelinek"
Date:
Subject: Re: ALTER TABLE ... NOREWRITE option