Re: Possible to insert quoted null value into integer field? - Mailing list pgsql-general

From Jerry Sievers
Subject Re: Possible to insert quoted null value into integer field?
Date
Msg-id m38yc4913h.fsf@prod01.jerrysievers.com
Whole thread Raw
Responses Re: Possible to insert quoted null value into integer field?
List 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 by date:

Previous
From: David Wheeler
Date:
Subject: Re: UTF-8 and LIKE vs =
Next
From: "Deepa K"
Date:
Subject: IP clash in the PC