Is there a way to test for UNASSIGNED in pl/pgsql

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Is there a way to test for UNASSIGNED in pl/pgsql
Date: 2012-10-29 15:34:51
Message-ID: 508EA21B.1070503@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

Is there a way to test for a variable being unassigned in pl/pgsql ?

I'm writing an audit trigger where I'd like to save full before and
after images into audit log and I really do not like to do

IF TG_OP IN ('INSERT', 'UPDATE') ...

I'd like rather better if i could just write

IF NEW IS ASSIGNED THEN ...

or even use it straight

null_if_unnasigned(NEW)

overriding

coalesce(NEW, NULL)

for the same purpose would also be ok

---------------------
Hannu

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Claudio Freire 2012-10-29 15:53:22 Re: [PATCH] Prefetch index pages for B-Tree index scans
Previous Message Alvaro Herrera 2012-10-29 15:27:30 Re: September 2012 commitfest