NULL and plpgsql rows

Поиск
Список
Период
Сортировка
От Jim C. Nasby
Тема NULL and plpgsql rows
Дата
Msg-id 20061002214150.GO81937@decibel.org
обсуждение исходный текст
Ответы Re: NULL and plpgsql rows  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: on-disk bitmap indexes
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: initdb ignores invalid locale names