Re: NULL and plpgsql rows - Mailing list pgsql-hackers

From Tom Lane
Subject Re: NULL and plpgsql rows
Date
Msg-id 16154.1159828103@sss.pgh.pa.us
Whole thread Raw
In response to NULL and plpgsql rows  ("Jim C. Nasby" <jim@nasby.net>)
Responses Re: NULL and plpgsql rows  (Jim Nasby <jim@nasby.net>)
Re: NULL and plpgsql rows  ("Sibte Abbas" <sibtay@gmail.com>)
List pgsql-hackers
"Jim C. Nasby" <jim@nasby.net> writes:
> However, the test right above that means that we'll fail if the user
> tries something like "row_variable := NULL;":

The patch you seem to have in mind would allowrow_variable := int_variable;
to succeed if the int_variable chanced to contain NULL, which is surely
not very desirable.

The real issue here is that the bare NULL has type UNKNOWN and we're not
making any effort to cast it.  I'm not sure whether it'd work to simply
apply exec_cast_value --- that looks like it's only meant to handle
scalars, where in general you'd need something close to
ExecEvalConvertRowtype().

> Of course, setting a row variable to null is a lot more useful if we can
> actually test for it after the fact, and I'm not really sure how to make
> that happen.

Doesn't IS NULL work (as of CVS HEAD)?
        regards, tom lane


pgsql-hackers by date:

Previous
From: AgentM
Date:
Subject: Re: timestamptz alias
Next
From: Bruce Momjian
Date:
Subject: Re: Broken link in PG docs