Re: Command Triggers - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Command Triggers
Date
Msg-id CA+TgmoYo4yiHNJOFUgcEL26YCTMai_YruDt0LEDJSbYoi1F0Tg@mail.gmail.com
Whole thread Raw
In response to Command Triggers  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
List pgsql-hackers
On Tue, Dec 13, 2011 at 10:53 AM, Merlin Moncure <mmoncure@gmail.com> wrote:
> On Tue, Dec 13, 2011 at 8:59 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>> Now, all that having been said, I also agree that the perfect can be
>> the enemy of the good, and we go there frequently.  The question I'm
>> asking is not whether the feature is perfect, but whether it's
>> adequate for even the most basic things people might want to do with
>> it.  Dimitri says that he wants it so that we can add support for
>> CREATE TABLE, ALTER TABLE, and DROP TABLE to Slony, Bucardo, and
>> Londiste.  My fear is that it won't turn out to be adequate to that
>> task, because there won't actually be enough information in the CREATE
>> TABLE statement to do the same thing on all servers.  In particular,
>> you won't have the index or constraint names, and you might not have
>> the schema or tablespace information either.
>
> But, you could query all that out from the system catalogs right?

You could probably get a lot of it that way, although first you'll
have to figure out which schema to look up the name in.  It seems
likely that everyone who uses the trigger will need to write that
code, though, and they'll all have different implementations with
different bugs, because many of them probably really want the facility
that you write in your next sentence:

> Maybe a better facility should exist to convert a table name to a
> create table statement than hand rolling it or invoking pg_dump, but
> that's a separate issue.
>
> This feature fills an important niche given that you can't hook RI
> triggers to system catalogs...it comes up (in short, +1).

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved
Next
From: Alvaro Herrera
Date:
Subject: Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved