On Thu, May 5, 2011 at 10:36 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > That is, in fact, exactly the behavior you get if you declare a RECORD > variable and set it to NULL. If these variables were indeed not > declared, you'd get a complaint about "new" not being a known variable.
Hrm, guess I learned something. I tested with a trigger function which used: ... IF NEW IS NULL THEN RAISE NOTICE 'new is null.'; ... which was giving me 'ERROR: record "new" is not assigned yet' when used as an on-delete trigger. I am a little surprised that you can't use IS NULL to test out a record-type variable which you've just declared to be NULL, e.g. this function blows up: CREATE OR REPLACE FUNCTION test_trg() RETURNS TRIGGER AS $$ DECLARE SOMEVAR record; BEGIN SOMEVAR := NULL; IF SOMEVAR IS NULL THEN RAISE NOTICE 'somevar is null.'; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql; with the same error message. Josh -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs