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

Re: Empty String Comparison Standard compliant?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:18:51
Message-ID: 13485.1075475931@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
Christoph Haller <ch(at)rodos(dot)fzk(dot)de> 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

In response to

pgsql-sql by date

Next:From: Stephan SzaboDate: 2004-01-30 15:29:21
Subject: Re: Empty String Comparison Standard compliant?
Previous:From: Christoph HallerDate: 2004-01-30 13:12:58
Subject: Empty String Comparison Standard compliant?

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