NULL and plpgsql rows - Mailing list pgsql-hackers

From Jim C. Nasby
Subject NULL and plpgsql rows
Date
Msg-id 20061002214150.GO81937@decibel.org
Whole thread Raw
Responses Re: NULL and plpgsql rows  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I'm looking at how NULLs are handled in relation to plpgsql row types.
Looking at exec_assign_value, it appears that we're supposed to be able
to handle setting a row variable to NULL:
               if (*isNull)               {                   /* If source is null, just assign nulls to the row */
             exec_move_row(estate, NULL, row, NULL, NULL);               }
 

However, the test right above that means that we'll fail if the user
tries something like "row_variable := NULL;":
               if (!(valtype == RECORDOID ||                     get_typtype(valtype) == 'c'))
ereport(ERROR,                          (errcode(ERRCODE_DATATYPE_MISMATCH),                            errmsg("cannot
assignnon-composite value to a row variable")));
 

Presumably, I can just add code to that test to allow for *isNull.

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.
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: on-disk bitmap indexes
Next
From: Bruce Momjian
Date:
Subject: Re: initdb ignores invalid locale names