Re: Question about inserts

Поиск
Список
Период
Сортировка
От Stijn Vanroye
Тема Re: Question about inserts
Дата
Msg-id 71E201BE5E881C46811BA160694C5FCB04672D@fs1000.farcourier.com
обсуждение исходный текст
Ответ на Question about inserts  (mike <mike@redtux1.uklinux.net>)
Ответы Re: Question about inserts  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
Maybe you can do something with this function:

[quote from the postgres docs]
9.12.2. COALESCE
COALESCE(value [, ...])
The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are
null.This is often useful to substitute a default value for null values when data is retrieved for display, for
example: 

SELECT COALESCE(description, short_description, '(none)') ...

Like a CASE expression, COALESCE will not evaluate arguments that are not needed to determine the result; that is,
argumentsto the right of the first non-null argument are not evaluated.  
[end quote]

Isn't it possible to pass "NULL" to the query in stead of ''?
eg. update table set datefield=NULL

Regards,

Stijn Vanroye

> Is it possible to to the following
>
> I have tables which are updated via webpage (perl) with fields of type
> int and date (all nullable). If the values are blank the entire insert
> fails, with a wrong type error.
>
> Is there any way to stop this behaviour so that the valid
> information is
> allowed,but the blank values get ignored.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faqs/FAQ.html
>

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

Предыдущее
От: mike
Дата:
Сообщение: Question about inserts
Следующее
От: Paul Thomas
Дата:
Сообщение: Re: Question about inserts