Trigger question - Mailing list pgsql-novice

From Pat Marchant
Subject Trigger question
Date
Msg-id 20011220214817.GA17920@lvcablemodem.com
Whole thread Raw
Responses Re: Trigger question
List pgsql-novice
I want to create a generic update trigger for all
tables in a DB using plpgsql. I'm thinking that having
one big trigger is more efficient than having a table
fire many triggers for each update.

To do this I need to know if an attribute exists in
the current table. For example, most of my tables
have an updated (datetime) field. I'd like to do
something like:

if (AttributeExists(new.updated))
   { new.updated = 'now'::datetime;}


I'd like to be able to use this trigger on
all tables - even if they don't have an
'updated' attribute.

Is there a way to do this?

-Pat Marchant

pgsql-novice by date:

Previous
From: Stephen Ingram
Date:
Subject: Using a tablename as a parameter to a function.
Next
From: Philip Hallstrom
Date:
Subject: Re: FW: Random Selection from TABLE