Gavin Sherry swm
Thu Feb 23 01:00:58 PST 2006
On Thu, 23 Feb 2006, Jim C. Nasby wrote:

> On Thu, Feb 23, 2006 at 03:02:14PM +1100, Gavin Sherry wrote:
> > On Wed, 22 Feb 2006, Darcy Buskermolen wrote:
> >
> > > On Wednesday 22 February 2006 08:48, Marc G. Fournier wrote:
> > > > Is there any work being done on Slony-I replicating DDL's?  And, of
> > > > course, setting up replication on any TABLES created in the process?
> > >
> > > No there is not any work on this.. in order to support this it would require
> > > hacks to the PG backend..  This could probably be done with Gavin's system
> > > table trigger patches.  The patches were never accepted for inclusion by
> > > core.
> >
> > The issue, for me, is that there are two ways we could go about
> > implementing this and both have problems.
> >
> > 1) Create triggers on individual system tables.
> >
> > If you wanted to know when a new table was created, when a table was
> > modified or dropped, you would create a trigger on pg_class, I suppose.
> > The problem, though, is that you might want to see what columns a new
> > table has but are they visible yet? It's a bit of a can of worms.
>
> Visible?? You mean you're worried about about seeing stuff that hasn't
> committed yet?

I was implying that it was a timing problem. In the code we create the
pg_class entry and then populate pg_attribute from memory. We need to be
careful about where we invoke a trigger on pg_class to make sure all it's
ramifications are visible -- ie, that we've issued
CommandCounterIncrement().

>
> > 2) Create triggers on DDL
> >
> > This seems to make more sense. You create a trigger on CREATE TABLE. I'm
> > not sure what you would pass the trigger in terms of data, but say you
> > managed to pass in some representation of the data surrounding the DDL
> > itself. There's a problem: what if people touch the system tables by hand?
>
> Are there any operations (other than CREATE DATABASE) that don't touch a
> system table?

CREATE DATABASE does touch system catalogs. But it is the same catalog in
*all databases*. There might be triggers on pg_database in a number of
databases but how do we invoke them?

Gavin



More information about the Slony1-general mailing list