Re: plpgsql allowing null fields in insert commands?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: plpgsql allowing null fields in insert commands?
Дата
Msg-id 20050316060521.E47369@megazone.bigpanda.com
обсуждение исходный текст
Ответ на plpgsql allowing null fields in insert commands?  ("Celia McInnis" <celia@drmath.ca>)
Ответы Re: plpgsql allowing null fields in insert commands?  ("Celia McInnis" <celia@drmath.ca>)
Список pgsql-novice
On Tue, 15 Mar 2005, Celia McInnis wrote:

> In a plpgsql procedure is there any way to form an insert command which has
> some null values for values of the inputs?
>
> Currently when I form such a command, the command becomes null if there are
> any null values inserted for the fields.

Are you making a query string for execute?
Something like:
 querystring := 'insert into foo(col1) values (' || variable || ')';
won't work if variable is null. You'd probably need something like:
 querystring := 'insert into foo(col1) values (' ||
  COALESCE(variable,'NULL') || ')';


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

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: plpgsql allowing null fields in insert commands?
Следующее
От: Greg Lindstrom
Дата:
Сообщение: XML and Postgres