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

Re: [JDBC] NULLs and sort order

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Rene Pijlman <rene(at)lab(dot)applinet(dot)nl>, pgsql-hackers(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] NULLs and sort order
Date: 2001-09-16 05:12:23
Message-ID: 16765.1000617143@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbc
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Rene Pijlman writes:
>> Currently the JDBC driver says:
>> - Backend >= 7.2 sorts nulls higher than any other value in a
>> domain. In other words: ascending means nulls at the end,
>> descending means nulls at the start.
>> - Backend < 7.2 puts nulls at the end regardless of sort order.

> That is correct.

Actually it's more complex than that.  7.2 will provide the above-stated
consistent ordering of nulls relative to non-nulls.  The problem with
earlier versions is that the ordering of nulls depends on what plan the
optimizer chooses for the query: sorting based on a scan of a btree
index would work the same as is described for 7.2, whereas sorting
based on an explicit sort step would put the nulls at the end (for
either ASC or DESC sort).  So there was *no* consistent behavior at all
in prior versions.  The fix that's been applied for 7.2 is to make
explicit sorts act the same as indexscans already did.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-09-16 05:22:35
Subject: Re: Warning about oid/xid wraparound
Previous:From: Bruce MomjianDate: 2001-09-16 05:05:07
Subject: Re: Warning about oid/xid wraparound

pgsql-jdbc by date

Next:From: Bruce MomjianDate: 2001-09-16 19:35:35
Subject: Re: UpdateableResultSet patch (not finished yet!)
Previous:From: Rene PijlmanDate: 2001-09-15 19:43:58
Subject: Re: isNullable()

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