[Triggers] Check if OLD or NEW records are NULL

From: "macieh" <macieh(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: [Triggers] Check if OLD or NEW records are NULL
Date: 2006-10-26 09:40:31
Message-ID: 1161855630.956738.29570@i3g2000cwc.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear All,

Can I check if OLD record is NULL in trigger function.
I'm using tg_op and check if it's UPDATE, etc. but I need check if OLD
record exists.
Is it possible?

f.i.

--------------------------------------------
IF OLD IS NOT NULL THEN

IF OLD.identity IS NULL THEN
tg_op_final:=''INSERT'';
ELSE
tg_op_final:=''UPDATE'';
END IF;

ELSE
tg_op_final:=''FILL_BY_DATALOADER'';
END IF;
-------------------------------------------

Thanks!
--
Best Regards
Maciek

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2006-10-26 11:04:20 Re: [GENERAL] Call for Donations
Previous Message Ron Johnson 2006-10-26 09:18:45 Re: Reducing pg_dump & pg_restore times