Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6599E4771A9 for ; Fri, 27 Sep 2002 08:46:05 -0400 (EDT) Received: from sv003.int.jongert.nl (jongert.nl [194.109.59.87]) by postgresql.org (Postfix) with ESMTP id 13B1047720D for ; Fri, 27 Sep 2002 08:40:11 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by sv003.int.jongert.nl (Postfix) with SMTP id 6A02F166; Fri, 27 Sep 2002 14:37:20 +0200 (CEST) Received: from IT001 (IT001.int.jongert.nl [10.0.0.241]) by sv003.int.jongert.nl (Postfix) with SMTP id ECECD165; Fri, 27 Sep 2002 14:37:19 +0200 (CEST) From: "Ries van Twisk" To: "'Ajit Aranha'" , Subject: Re: Null not equal to '' (empty) Date: Fri, 27 Sep 2002 14:40:06 +0200 Message-ID: <000001c26623$02f515a0$f100000a@IT001> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Importance: Normal In-Reply-To: <20020920060916.42881.qmail@web14104.mail.yahoo.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/375 X-Sequence-Number: 9652 This is because '' is not equal to NULL '' Means a empty string NULL means a empty set So this: SELECT * FROM tbl WHERE c1 IS NULL; is totally different then: SELECT * FROM tbl WHERE c1=''; Ries -----Oorspronkelijk bericht----- Van: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]Namens Ajit Aranha Verzonden: vrijdag 20 september 2002 8:09 Aan: pgsql-sql@postgresql.org Onderwerp: [SQL] Null not equal to '' (empty) Why is ''(empty) not equal to null? Its a major headache when porting from other RDBMS like Oracle. Anyone knows any easy workarounds? i.e. if you use: create table tbl ( c1 varchar(5)); insert into tbl values (''); select * from tbl where c1 is null; will return zero rows. Also try this: select TO_DATE('','DD-MM-YY'); and this TO_DATE('','DD-Mon-YY'); ;-) -Ajit (ajit_aranha@rocketmail.com) __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster