Verify a record has a column in a plpgsql trigger - Mailing list pgsql-general

From Mike Ginsburg
Subject Verify a record has a column in a plpgsql trigger
Date
Msg-id 4B6AF8B6.3050802@collaborativefusion.com
Whole thread Raw
Responses Re: Verify a record has a column in a plpgsql trigger  (Merlin Moncure <mmoncure@gmail.com>)
List 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



pgsql-general by date:

Previous
From: "Wang, Mary Y"
Date:
Subject: Any Good Postgresql Courses Offered in the US Area?
Next
From: Rich Shepard
Date:
Subject: Re: Any Good Postgresql Courses Offered in the US Area?