Re: ALTER TABLE ... NOREWRITE option

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Petr Jelinek <pjmodos(at)pjmodos(dot)net>
Cc: 'Simon Riggs' <simon(at)2ndQuadrant(dot)com>, 'Robert Haas' <robertmhaas(at)gmail(dot)com>, 'Dimitri Fontaine' <dimitri(at)2ndquadrant(dot)fr>, 'Josh Berkus' <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE ... NOREWRITE option
Date: 2012-12-06 19:43:42
Message-ID: 20121206194341.GA31249@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2012-12-06 20:27:33 +0100, Petr Jelinek wrote:
> > -----Original Message-----
> > From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-
> > owner(at)postgresql(dot)org] On Behalf Of Andres Freund
> > Sent: 06 December 2012 20:04
> > To: Simon Riggs
> > Cc: Robert Haas; Dimitri Fontaine; Josh Berkus;
> pgsql-hackers(at)postgresql(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2012-12-06 19:59:38 Re: ALTER TABLE ... NOREWRITE option
Previous Message Petr Jelinek 2012-12-06 19:27:33 Re: ALTER TABLE ... NOREWRITE option