Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 6791C9FB411 for ; Tue, 30 Jan 2007 12:38:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 54869-05 for ; Tue, 30 Jan 2007 12:38:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from druid.net (druid.net [66.96.28.249]) by postgresql.org (Postfix) with ESMTP id 6CADE9FB3DA for ; Tue, 30 Jan 2007 12:38:33 -0400 (AST) Received: from dilbert.druid.net (H245.C18.B96.tor.eicat.ca [66.96.18.245]) by druid.net (Postfix) with SMTP id EED8EB49F; Tue, 30 Jan 2007 11:38:33 -0500 (EST) Date: Tue, 30 Jan 2007 11:38:34 -0500 From: "D'Arcy J.M. Cain" To: Andrew Sullivan Cc: pgsql-sql@postgresql.org Subject: Re: Differentiate Between Zero-Length String and NULLColumn Values Message-Id: <20070130113834.fa8d09e0.darcy@druid.net> In-Reply-To: <20070130142332.GA31905@phlogiston.dyndns.org> References: <20070130131334.GD31676@phlogiston.dyndns.org> <45BF584F.A3DD.0030.0@indicator.be> <20070130142332.GA31905@phlogiston.dyndns.org> X-Mailer: Sylpheed version 2.2.0 (GTK+ 2.8.12; i386-portbld-freebsd6.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/160 X-Sequence-Number: 27312 On Tue, 30 Jan 2007 09:23:32 -0500 Andrew Sullivan wrote: > 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 :) I don't have an Oracle installation here and I haven't used it much but I wonder if they treat the following two statements differently. SELECT * FROM table WHERE column IS NULL; SELECT * FROM table WHERE column = NULL; The latter violates the SQL spec and is not allowed by PostgreSQL without setting a special flag. Is it possible that Oracle accepts "=" against NULL and also treats it slightly differently? -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.