Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id DF1D89FB403 for ; Tue, 30 Jan 2007 10:38:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 55548-07 for ; Tue, 30 Jan 2007 10:37:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mailsrv.TIPPCOMDOM (mailrelay.tippcom.co.il [212.199.51.236]) by postgresql.org (Postfix) with ESMTP id 0E1749FB3F0 for ; Tue, 30 Jan 2007 10:37:58 -0400 (AST) Received: from herouth.prv.il.itouchnet.net ([192.168.34.34]) by mailsrv.TIPPCOMDOM with Microsoft SMTPSVC(6.0.3790.1830); Tue, 30 Jan 2007 16:37:40 +0200 From: Herouth Maoz Organization: TippCom To: pgsql-sql@postgresql.org Subject: Re: Differentiate Between Zero-Length String and NULLColumn Values Date: Tue, 30 Jan 2007 16:37:43 +0200 User-Agent: KMail/1.8.2 References: <20070130131334.GD31676@phlogiston.dyndns.org> <45BF584F.A3DD.0030.0@indicator.be> <20070130142332.GA31905@phlogiston.dyndns.org> In-Reply-To: <20070130142332.GA31905@phlogiston.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200701301637.43897.herouth@tippcom.co.il> X-OriginalArrivalTime: 30 Jan 2007 14:37:40.0671 (UTC) FILETIME=[31DF74F0:01C7447C] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.954 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200701/158 X-Sequence-Number: 27310 Andrew Sullivan Wrote: > On Tue, Jan 30, 2007 at 02:38:07PM +0100, Bart Degryse wrote: > > Andrew, I think you're wrong stating that Oracle would interpret > > NULL and empty string as equal. The Oracle databases I use (8, 9 > > and 10) certainly make a distiction between both values. Maybe > > earlier versions did so, that I don't know. > > Hmm. Well, I'm not an Oracle guy, so I don't really know. All I > know is that we occasionally get people coming from Oracle who are > surprised by this difference. What I've been _told_ is that '' and > NULL are under some circumstances (maybe integers?) the same thing, > whereas of course ' ' and NULL are not. But since I'm not an Oracle > user, people should feel free to ignore me :) Sybase does something like that... In sybase, null and empty string are the same. However, to avoid the equality ''=NULL, they actually interpret '' as a single space. So if you do something like SELECT 'A'+''+'C' (concatenation is + in sybase), it results in 'A C'. Null is a "real" empty string in that its length is zero, and if you insert a trim('') into a column, it will treat it as NULL. Herouth