Verify a record has a column in a plpgsql trigger

From: Mike Ginsburg <mginsburg(at)collaborativefusion(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Verify a record has a column in a plpgsql trigger
Date: 2010-02-04 16:41:26
Message-ID: 4B6AF8B6.3050802@collaborativefusion.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a plpgsql function that serves as a change log for a few tables
in my db (8.4.2). In most of the tables that I am logging, there is an
"editor" column that stores the ID of the user who made the change, so
as part of the function I set

editor := NEW.editor;

There are a few of the tables that don't store editor, in which case I
am ok with inserting it into the log as NULL. The problem is I can't
seem to come up with a conditional to see if NEW has a column named
"editor".

Any help is greatly appreciated.
Thanks.

Mike Ginsburg

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2010-02-04 16:51:45 Re: Any Good Postgresql Courses Offered in the US Area?
Previous Message Wang, Mary Y 2010-02-04 16:28:22 Any Good Postgresql Courses Offered in the US Area?