Re: DDL Damage Assessment - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: DDL Damage Assessment
Date
Msg-id m2fvf6cdmt.fsf@2ndQuadrant.fr
Whole thread Raw
In response to Re: DDL Damage Assessment  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
>>   - will the table have to be rewritten? the indexes?
>
> Please give my DDL deparsing patch a look.  There is a portion there
> about deparsing ALTER TABLE specifically; what it does is save a list of
> subcommands, and for each of them we either report the OID of the object
> affected (for example in ADD CONSTRAINT), or a column number (for ALTER
> COLUMN RENAME, say).  It sounds like you would like to have some extra
> details returned: for instance the "does the whole of it require a table
> rewrite" bit.  It sounds like it can be trivially returned in the JSON

Some years ago when working on the Event Trigger framework we did
mention providing some interesting events, such as a TableRewrite Event.

In between what you're saying here and what Harold and Peter Geoghegan
are mentionning (basically that dealing with table rewrites is 90% of
the need for them), it could be that the best way to have at it would be
to add that Event in the Event Trigger mechanism.

We could also add an AccessExclusiveLock Event that would fire just
before actually taking the lock, allowing people to RAISE EXCEPTION in
that case, or to maybe just do the LOCK … NOWAIT themselves in the
trigger.

For the locking parts, best would be to do the LOCK … NOWAIT dance for
all the tables touched by the DDL migration script. The Event Trigger
approach will not solve that, unfortunately.

Regards,
--
Dimitri Fontaine                                        06 63 07 10 78
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Per table autovacuum vacuum cost limit behaviour strange
Next
From: Jan Wieck
Date:
Subject: Re: DDL Damage Assessment