Re: Broken handling of NULLs in TG_ARGV

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Broken handling of NULLs in TG_ARGV
Date: 2015-04-30 23:44:39
Message-ID: 36959.1430437479@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> plpgsql's handling of NULLs in TG_ARGV turns actual nulls into text
> 'null'. Hopefully we can all agree that's broken.

You apparently have not read the CREATE TRIGGER reference page very
carefully:

arguments

An optional comma-separated list of arguments to be
provided to the function when the trigger is executed. The
arguments are literal string constants. Simple names and
numeric constants can be written here, too, but they will
all be converted to strings.

There isn't any such thing as a genuine SQL NULL argument; the examples
you provided are just text strings, not SQL NULLs. In order to make them
be actual nulls, we would have to redefine the arguments as being
expressions of some sort, which is problematic for backwards-compatibility
reasons. It also seems like rather a lot of new mechanism to add for
something with (evidently) near-zero user demand.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-04-30 23:49:32 Re: initdb -S and tablespaces
Previous Message Jim Nasby 2015-04-30 23:26:23 Broken handling of NULLs in TG_ARGV