Reference to NEW, OLD values in TRIGGER - Mailing list pgsql-general

From Andrey Mosienko
Subject Reference to NEW, OLD values in TRIGGER
Date
Msg-id 3CD81B04.2020308@ttn.ru
Whole thread Raw
List pgsql-general
Hello All!

How can I access NEW or OLD fields in trigger with variable?
I need it to create more universal function to work with tables
when I don't know the table structure.

Example:

Now:
IF NEW.empname ISNULL THEN
             RAISE EXCEPTION ''empname cannot be NULL value'';
END IF;


As I wish. or something like that:
DECLARE
    str text;
BEGIN
    str := 'empname';
IF NEW.''str'' ISNULL THEN
    ^^^^^^
             RAISE EXCEPTION ''empname cannot be NULL value'';
END IF;
END;




pgsql-general by date:

Previous
From: Neil Conway
Date:
Subject: Re: Index usage vs large repetitions of key
Next
From: Jason Earl
Date:
Subject: Re: Contrib reindex script: