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: | Pine.BSF.4.10.10011271358500.10460-100000@rodent.webhosting.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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 -=- http://www.freebsd.org/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-11-27 19:07:16 | Re: [HACKERS] Indexing for geographic objects? |
Previous Message | Don Baccus | 2000-11-27 18:47:27 | Re: Question about Oracle compatibility |