Re: JDBC: what exactly does nullsAreSortedHigh() return?

From: Derek Chen-Becker <dbecker(at)cpicorp(dot)com>
To: Vikas Rana <vikasrana(at)techie(dot)com>, firstsql(at)ix(dot)netcom(dot)com
Subject: Re: JDBC: what exactly does nullsAreSortedHigh() return?
Date: 2004-06-03 14:05:34
Message-ID: 40BF302E.4040709@cpicorp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Vikas Rana wrote:
> Hi all,
>
> I am a bit confused about the method
> java.sql.DatabaseMetaData.nullsAreSortedHigh(). What exactly does this
> return? If this returns true, are nulls considered as the highest
> value? Or does this mean that nulls comes first when sorted in
> ascending order (opposite in meaning to the first).
>
> Consider this.
>
> - Oracle returns false. Nulls are last when sorted in ascending order.
>
> - MSSQL2K returns true. Nulls are first when sorted in ascending
> order.
>
> - Postgres returns true. Nulls are last when sorted in ascending
> order.
>
> Now, behavior of Oracle and Postgres is same in terms of sort order,
> but they return different values.
>
> Who is right?

Here's the info from JDK1.4.2:

nullsAreSortedHigh

public boolean nullsAreSortedHigh()
throws SQLException

Retrieves whether NULL values are sorted high. Sorted high means
that NULL values sort higher than any other value in a domain. In an
ascending order, if this method returns true, NULL values will appear at
the end. By contrast, the method nullsAreSortedAtEnd indicates whether
NULL values are sorted at the end regardless of sort order.

Returns:
true if so; false otherwise
Throws:
SQLException - if a database access error occurs

So it seems that both Oracle and MSSQL are wrong...

Derek

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Terry Lee Tucker 2004-06-03 14:13:23 Re: A "linking" Question
Previous Message Manfred Koizar 2004-06-03 14:01:11 Re: Creating a session variable in Postgres