[Triggers] Check if OLD or NEW records are NULL - Mailing list pgsql-general

From macieh
Subject [Triggers] Check if OLD or NEW records are NULL
Date
Msg-id 1161855630.956738.29570@i3g2000cwc.googlegroups.com
Whole thread Raw
List 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


pgsql-general by date:

Previous
From: "Roberto Hartke Neto"
Date:
Subject: Updating client table definitions from server tables without losing client data
Next
From: "Fip"
Date:
Subject: grouping excluding some text results