X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4768DD1B474 for ; Fri, 30 Jan 2004 15:18:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 68715-03 for ; Fri, 30 Jan 2004 11:18:52 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 45775D1BCA7 for ; Fri, 30 Jan 2004 11:18:48 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i0UFIqVi013486; Fri, 30 Jan 2004 10:18:52 -0500 (EST) To: Christoph Haller Cc: pgsql-sql@postgresql.org Subject: Re: Empty String Comparison Standard compliant? In-reply-to: <200401301212.NAA11553@rodos> References: <200401301212.NAA11553@rodos> Comments: In-reply-to Christoph Haller message dated "Fri, 30 Jan 2004 13:12:58 +0700" Date: Fri, 30 Jan 2004 10:18:51 -0500 Message-ID: <13485.1075475931@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/285 X-Sequence-Number: 16678 Christoph Haller writes: > [ '' is less than 'GDMF' ] > Are these results standard compliant? I doubt that the SQL standard really says anything on the subject, but ISTM any rational string-sorting algorithm would put '' before anything else. > It's just because I have a DBMS here, where the results are vice versa. Let me guess ... it's Oracle? Last I heard Oracle had a problem distinguishing empty strings from NULLs. If it sorts NULLs at the end then it wouldn't be surprising for empty strings to come out at the end in an ORDER BY sort. However, I'm not sure that explains the exact example you cite of boolean comparison results. If it were taking the '' as a NULL then both comparisons ought to return NULL. regards, tom lane