Trigger question

From: Pat Marchant <patmarchant(at)lvcablemodem(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Trigger question
Date: 2001-12-20 21:48:17
Message-ID: 20011220214817.GA17920@lvcablemodem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Kris-Jon Fenton 2001-12-20 22:08:47 Re: FW: Random Selection from TABLE
Previous Message Josh Berkus 2001-12-20 19:28:34 Re: (Last) revision ?