Re: Problems with "order by clause"

From: Barry Lind <barry(at)xythos(dot)com>
To: Erik Behrends <erik(dot)behrends(at)inxnet(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problems with "order by clause"
Date: 2002-04-26 15:48:34
Message-ID: 3CC976D2.5010501@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Erik,

This isn't really a jdbc question, problably should be addressed on
pgsql-general, or pgsql-sql, however I will give it a try. On my system
I actually see the same results as Oracle and Sapdb and not the results
you are reporting for postgres. This would lead me to believe that the
behavior you are seeing is correct behavior but that you are running
postgres with a locale that is different than mine. Sort order is
determined by the locale that you are running under. My database is
installed with a C locale (i.e. binary sort order) as opposed to a
language/territory specific locale that would produce a different ordering.

thanks,
--Barry

Erik Behrends wrote:
> Hello to everybody,
>
> I have a little problem concerning the "ORDER BY" clause.
> Consider a table "test" having one text field "val" with the following
> entries:
>
> tralala
> Tralala
> tralal
>
> Now, I want to execute the following query via JDBC:
> SELECT * FROM test ORDER BY val DESC;
> When using JDBC with Oracle or Sapdb I get the following result:
>
> tralala
> tralal
> Tralala
>
> (correct lexicographic order as expected by Java)
>
> Now, using PostgreSQL (7.1.3 with JDBC driver 7.2) the result is:
>
> Tralala
> tralala
> tralal
>
> (lexicographic order as implemented in PostgreSQL)
>
> Any ideas what's going on there?
> Thanks in advance,
>
> -- Erik Behrends
> ----------------------------------------------
> Inxnet GmbH
> intelligent software solutions
> tel. 0761 / 296 979-0
> http://www.inxnet.de
> ----------------------------------------------
> P.S.: Versenden personalisierter E-Mails - mit
> inxmail ein Kinderspiel! http://www.inxmail.de
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Erik Behrends 2002-04-26 16:38:40 Re: Problems with "order by clause"
Previous Message Erik Behrends 2002-04-26 12:12:10 Problems with "order by clause"