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 E6F5ED1BA96 for ; Fri, 30 Jan 2004 15:29:22 +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 72299-05 for ; Fri, 30 Jan 2004 11:29:26 -0400 (AST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 72048D1B4C9 for ; Fri, 30 Jan 2004 11:29:22 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 9520535635; Fri, 30 Jan 2004 07:29:21 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 93A453561A; Fri, 30 Jan 2004 07:29:21 -0800 (PST) Date: Fri, 30 Jan 2004 07:29:21 -0800 (PST) From: Stephan Szabo To: Christoph Haller Cc: pgsql-sql@postgresql.org Subject: Re: Empty String Comparison Standard compliant? In-Reply-To: <200401301212.NAA11553@rodos> Message-ID: <20040130072502.O55110@megazone.bigpanda.com> References: <200401301212.NAA11553@rodos> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/286 X-Sequence-Number: 16679 On Fri, 30 Jan 2004, Christoph Haller wrote: > Just a short question (PostgreSQL 7.3.4 on hppa-hp-hpux10.20, compiled by GCC 2.8.1) > > SELECT ('' > 'GDMF') ; SELECT ('GDMF' > ''); > ?column? > ---------- > f > (1 row) > > ?column? > ---------- > t > (1 row) > > Are these results standard compliant? I think so in general. If the two lengths are not equal, then "effectively" the shorter string is replaced by an extended version. If it's NO PAD (varchar/text for us) the character used is a character that sorts less than any string. Otherwise (char) it's a space. Then you use the collating sequence to determine the value of >. Most will put space before any of GDMF, so the above seems reasonable.