Re: Create user trigger?

Lists: pgsql-general
From: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Cc: slony1-general(at)lists(dot)slony(dot)info
Subject: Create user trigger?
Date: 2008-03-18 10:32:56
Message-ID: 501266.73767.qm@web25812.mail.ukl.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi Chaps,

We're setting up 3 servers replicating using slony. I was wondering if it'd be possible for me to create a set of triggers that fire whenever a user is created/dropped/modified on one of the servers that goes and performs the same action the other two servers.

Does that sound doable?

I'm not sure what the implications of doing this would be, and I'mm not sure the best way to do it.... But this is what I was thinking of doing:

Have a user table containing all the usernames, and every time a user is inserted/deleted from the table create/drop the user using a trigger. Then put the table in replication using slony.

Obviously I'd have to drop and then recreate the users when I wanted to alter them, and I'd have to meke sure permissions were set properly to the table.

Are there any better alternatives?

Thanks

___________________________________________________________
Rise to the challenge for Sport Relief with Yahoo! For Good

http://uk.promotions.yahoo.com/forgood/


From: Decibel! <decibel(at)decibel(dot)org>
To: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>
Cc: General mailing list postgres <pgsql-general(at)postgresql(dot)org>
Subject: Re: Create user trigger?
Date: 2008-03-25 01:36:04
Message-ID: B1B9AC05-4481-4D65-8941-CE023AC2FDE3@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dropping the slony list.

On Mar 18, 2008, at 5:32 AM, Glyn Astill wrote:
> We're setting up 3 servers replicating using slony. I was wondering
> if it'd be possible for me to create a set of triggers that fire
> whenever a user is created/dropped/modified on one of the servers
> that goes and performs the same action the other two servers.

There is no support for DDL triggers, even though it's frequently
requested. Unfortunately, almost every time it's brought up it
degrades into a debate about why we can't add triggers to catalog
tables; forgetting that there's other ways to do this. Searching the
pgsql-hackers archives should be enlightening.
--
Decibel!, aka Jim C. Nasby, Database Architect decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Decibel!" <decibel(at)decibel(dot)org>
Cc: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>, General mailing list postgres <pgsql-general(at)postgresql(dot)org>
Subject: Re: Create user trigger?
Date: 2008-03-25 14:44:36
Message-ID: 200803251444.m2PEiaI07538@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Decibel! wrote:
> Dropping the slony list.
>
> On Mar 18, 2008, at 5:32 AM, Glyn Astill wrote:
> > We're setting up 3 servers replicating using slony. I was wondering
> > if it'd be possible for me to create a set of triggers that fire
> > whenever a user is created/dropped/modified on one of the servers
> > that goes and performs the same action the other two servers.
>
> There is no support for DDL triggers, even though it's frequently
> requested. Unfortunately, almost every time it's brought up it
> degrades into a debate about why we can't add triggers to catalog
> tables; forgetting that there's other ways to do this. Searching the
> pgsql-hackers archives should be enlightening.

We have a potential patch for 8.4 for this.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +