Re: Possible to insert quoted null value into integer field?

Поиск
Список
Период
Сортировка
От Jerry Sievers
Тема Re: Possible to insert quoted null value into integer field?
Дата
Msg-id m38yc4913h.fsf@prod01.jerrysievers.com
обсуждение исходный текст
Ответы Re: Possible to insert quoted null value into integer field?  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
pablo_tweek@yahoo.com (Pablo S) writes:

> Hi all, I have search high and low on this -
> Take for instance the statement :
>
> insert into foo (text1, text2, int1) values ('Foo', 'Bar', '');

Have a look at nullif();

create table foo (a int)
;

insert into foo
values (nullif('$varWhichMayBeEmptyString', '')::int)
;

As I recall, there is a comment in the release notes somewhere between
your PG version and the current one, that int cols no longer take
empty string as NULL.

HTH

--
-------------------------------------------------------------------------------
Jerry Sievers   305 854-3001 (home)     WWW ECommerce Consultant
                305 321-1144 (mobile    http://www.JerrySievers.com/

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

Предыдущее
От: David Wheeler
Дата:
Сообщение: Re: UTF-8 and LIKE vs =
Следующее
От: "Deepa K"
Дата:
Сообщение: IP clash in the PC