Skip site navigation (1) Skip section navigation (2)

Re: Question about Oracle compatibility

From: Alex Perel <veers(at)webhosting(dot)com>
To: Don Baccus <dhogaza(at)pacifier(dot)com>
Cc: Mario Weilguni <mweilguni(at)sime(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question about Oracle compatibility
Date: 2000-11-27 19:00:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Mon, 27 Nov 2000, Don Baccus wrote:

> >Actually, they aren't the same at all under Oracle or under Postgres.
> >
> >A null represents a lack of data, whereas an empty string is represents
> >data of zero length and zero content. Null is a state and not a value.
> Unfortunately Mario's entirely correct (I use Oracle...)
> insert into foo (some_string) values ('');
> will insert a NULL, not an empty string, into the column some_string.

I stand corrupted. I didn't remember this behavior. :/
> >What you are probably seeing is a difference in table layout that sets
> >a default value of '' for the particular column you're touching. You can 
> >have postgres do the same by specifying DEFAULT '' when you create your
> >table (or you could ALTER it in..).
> Using "DEFAULT ''" might help some, but he specifically mentioned inserting
> form data from a web page, and in this case he'll have to check the string
> and explicitly insert NULL (or write a trigger for each table that does
> the check and the resulting massage of the value) or rewrite his queries
> to treat empty string as being the same as NULL explicitly.

Might be easiest to feed the data through a simple stored proc. Doesn't take
long at all to whip something together for the purpose..

      Alex G. Perel  -=-  AP5081
veers(at)disturbed(dot)net  -=-  alex(dot)perel(at)inquent(dot)com
               play  -=-  work                      
Disturbed Networks - Powered exclusively by FreeBSD
== The Power to Serve -=-     

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2000-11-27 19:07:16
Subject: Re: [HACKERS] Indexing for geographic objects?
Previous:From: Don BaccusDate: 2000-11-27 18:47:27
Subject: Re: Question about Oracle compatibility

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group