Search Postgresql Archives

Re: order by question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steve Clark <sclark@xxxxxxxxxxxxx> wrote:

> I am confused by how postgres 8,4..13 is sorting my data.

> select * from test order by data;
>     data
> ----------
>
>   -
>   --
>   1
>   11
>   11F
>   1F
>   a
>   b
>   C
>   F
>   -F
>   Feneric
>   Generic
> (14 rows)
>
> The first row is a single space, the next row a single -, the next two -- .
> What I don't understand is why the '-F', the ' Feneric' and
> the ' Generic' sort where they do.
>
> I would expect the output to be like this:
>
>     data
> ----------
>
>   Feneric
>   Generic
>   -
>   --
>   -F
>   1
>   11
>   11F
>   1F
>   a
>   b
>   C
>   F
> (14 rows)

>   lc_collate
> -------------
>   en_US.UTF-8

PostgreSQL uses the OS collations.  What you are getting matches my
Ubuntu 14.04 machine:

kgrittn@Kevin-Desktop:~/pg/master$ echo $LANG
en_US.UTF-8
kgrittn@Kevin-Desktop:~/pg/master$ sort <<XXX
>
>   Feneric
>   Generic
>   -
>   --
>   -F
>   1
>   11
>   11F
>   1F
>   a
>   b
>   C
>   F
> XXX

  -
  --
  1
  11
  11F
  1F
  a
  b
  C
  F
  -F
  Feneric
  Generic

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux