pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christoph Haller <ch@rodos.fzk.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Empty String Comparison Standard compliant?
Date: Fri, 30 Jan 2004 10:18:51 -0500
Message-ID: <13485.1075475931@sss.pgh.pa.us> (raw)
In-Reply-To: <200401301212.NAA11553@rodos>
References: <200401301212.NAA11553@rodos>

Christoph Haller <ch@rodos.fzk.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



view thread (3+ messages)  latest in thread

Message-ID: <13485.1075475931@sss.pgh.pa.us>
Permalink:  ../13485.1075475931@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13485.1075475931@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ch@rodos.fzk.de
  Subject: Re: Empty String Comparison Standard compliant?
  In-Reply-To: <13485.1075475931@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox