Re: Question about Oracle compatibility
От | Alex Perel |
---|---|
Тема | Re: Question about Oracle compatibility |
Дата | |
Msg-id | Pine.BSF.4.10.10011271358500.10460-100000@rodent.webhosting.com обсуждение исходный текст |
Ответ на | Re: Question about Oracle compatibility (Don Baccus <dhogaza@pacifier.com>) |
Список | 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@disturbed.net -=- alex.perel@inquent.com play -=- work Disturbed Networks - Powered exclusively by FreeBSD == The Power to Serve -=- http://www.freebsd.org/
В списке pgsql-hackers по дате отправления: