From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: WIP: hooking parser |
Date: | 2009-02-16 14:21:12 |
Message-ID: | 162867790902160621n5d4bb420sfb413f0669606732@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2009/2/16 Sam Mason <sam(at)samason(dot)me(dot)uk>:
> On Mon, Feb 16, 2009 at 02:35:54PM +0100, Pavel Stehule wrote:
>> attachment contains module that transform every empty string to null.
>
> Why would anyone ever want to do this? This would appear to break all
> sorts of things in very non-obvious ways:
I agree, so this behave is strange - but Oracle does it.
so normal query in Oracle for empty value looks like
select * from people where surname is null;
and some application expect transformation from '' to null.
http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/
so these modules (decode, oraemptystr) decrease differences between
PostgreSQL and Oracle.
Regards
Pavel Stehule
p.s. I am not Oracle expert, I expect so here are more qualified men.
>
> SELECT CASE s WHEN '' THEN 'empty string' ELSE s END FROM foo;
> UPDATE foo SET s = NULL WHERE s = '';
>
> would no longer do the expected thing. It would only do the expected
> thing (in my eyes) when strings of zero length were actually being
> inserted into the database. Like:
>
> INSERT INTO foo (s) VALUES ('');
> UPDATE foo SET s = '' WHERE s = 'empty string';
>
> Or am I missing something obvious?
>
> --
> Sam http://samason.me.uk/
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2009-02-16 14:23:26 | Re: SE-PostgreSQL and row level security |
Previous Message | Sam Mason | 2009-02-16 14:09:22 | Re: WIP: hooking parser |