Skip site navigation (1) Skip section navigation (2)

Re: Empty String Comparison Standard compliant?

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Empty String Comparison Standard compliant?
Date: 2004-01-30 15:29:21
Message-ID: 20040130072502.O55110@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-sql
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.



In response to

pgsql-sql by date

Next:From: mohanDate: 2004-01-30 16:04:21
Subject: PROBLEM SOLVEDRe: java.lang.StringIndexOutOfBoundsException: String index
Previous:From: Tom LaneDate: 2004-01-30 15:18:51
Subject: Re: Empty String Comparison Standard compliant?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group