Re: Passing nulls into PL/pgSQL functions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Passing nulls into PL/pgSQL functions
Дата
Msg-id 362.1050525091@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Passing nulls into PL/pgSQL functions  (Adam Witney <awitney@sghms.ac.uk>)
Список pgsql-general
Adam Witney <awitney@sghms.ac.uk> writes:
> Is it possible to pass a null value into a PL/pgSQL function.

Certainly.

Your problem is with the EXECUTE, or even more specifically with the
string concatenation expression you're using to build the EXECUTE
expression.  Do you really need an EXECUTE here at all?  If so,
something involving COALESCE would work.  I'd try

EXECUTE ''INSERT ....'' || coalesce(quote_literal(_name), ''NULL'') || '')'';

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Adam Witney
Дата:
Сообщение: Passing nulls into PL/pgSQL functions
Следующее
От: Jeffrey Melloy
Дата:
Сообщение: Cocoa Apps