pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #8118: Wrong sorting text
4+ messages / 4 participants
[nested] [flat]

* BUG #8118: Wrong sorting text
@ 2013-04-26 18:36  whiplash@bss.org.ua
  0 siblings, 1 reply; 4+ messages in thread

From: whiplash@bss.org.ua @ 2013-04-26 18:36 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      8118
Logged by:          whiplash
Email address:      whiplash@bss.org.ua
PostgreSQL version: 9.2.2
Operating system:   Linux (Fedora 11, Fedora 16 and Ubuntu 12.04)
Description:        

I execute query (1):

SELECT t.name
FROM
(
    SELECT 'AAA AAA' AS name
    UNION ALL
    SELECT 'AAA_AAA'
    UNION ALL 
    SELECT 'BBB_AAA'
    UNION ALL
    SELECT 'BBB AAB'
) t
ORDER BY t.name

and I getting a result:

AAA AAA
AAA_AAA
BBB_AAA
BBB AAB

I think this is result more correct:

AAA AAA
AAA_AAA
BBB AAB
BBB_AAA

On Windows 7 and FreeBSD 9.x query (1) returns correct result.



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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #8118: Wrong sorting text
@ 2013-04-27 04:04  Jov <amutu@amutu.com>
  parent: whiplash@bss.org.ua
  0 siblings, 1 reply; 4+ messages in thread

From: Jov @ 2013-04-27 04:04 UTC (permalink / raw)
  To: whiplash@bss.org.ua; +Cc: pgsql-bugs

also reproduce on SUSE linux 10 x86_64 pgsql9.2.4:

 test=# SELECT t.name
FROM
(
    SELECT '_A'::varchar as name
    UNION ALL
    SELECT ' B'::varchar
) t
ORDER BY t.name;
 name
------
 _A
  B
(2 rows)

test=# SELECT t.name
FROM
(
    SELECT '_A'::varchar as name
    UNION ALL
    SELECT ' A'::varchar
) t
ORDER BY t.name;
 name
------
  A
 _A
(2 rows)


2013/4/27 <whiplash@bss.org.ua>

> The following bug has been logged on the website:
>
> Bug reference:      8118
> Logged by:          whiplash
> Email address:      whiplash@bss.org.ua
> PostgreSQL version: 9.2.2
> Operating system:   Linux (Fedora 11, Fedora 16 and Ubuntu 12.04)
> Description:
>
> I execute query (1):
>
> SELECT t.name
> FROM
> (
>     SELECT 'AAA AAA' AS name
>     UNION ALL
>     SELECT 'AAA_AAA'
>     UNION ALL
>     SELECT 'BBB_AAA'
>     UNION ALL
>     SELECT 'BBB AAB'
> ) t
> ORDER BY t.name
>
> and I getting a result:
>
> AAA AAA
> AAA_AAA
> BBB_AAA
> BBB AAB
>
> I think this is result more correct:
>
> AAA AAA
> AAA_AAA
> BBB AAB
> BBB_AAA
>
> On Windows 7 and FreeBSD 9.x query (1) returns correct result.
>
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>



-- 
Jov
blog: http:amutu.com/blog <http://amutu.com/blog;

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #8118: Wrong sorting text
@ 2013-04-28 21:05  Daniele Varrazzo <daniele.varrazzo@gmail.com>
  parent: Jov <amutu@amutu.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Daniele Varrazzo @ 2013-04-28 21:05 UTC (permalink / raw)
  To: Jov <amutu@amutu.com>; +Cc: whiplash@bss.org.ua; pgsql-bugs

>> Bug reference:      8118
>> Logged by:          whiplash
>> Email address:      whiplash@bss.org.ua
>> PostgreSQL version: 9.2.2
>> Operating system:   Linux (Fedora 11, Fedora 16 and Ubuntu 12.04)
>> Description:
>>
>> I execute query (1):
>>
>> SELECT t.name
>> FROM
>> (
>>     SELECT 'AAA AAA' AS name
>>     UNION ALL
>>     SELECT 'AAA_AAA'
>>     UNION ALL
>>     SELECT 'BBB_AAA'
>>     UNION ALL
>>     SELECT 'BBB AAB'
>> ) t
>> ORDER BY t.name
>>
>> and I getting a result:
>>
>> AAA AAA
>> AAA_AAA
>> BBB_AAA
>> BBB AAB

It's a matter of collate. If you want ascii ordering specify collate "C".

...
ORDER BY t.name collate "C";
  name
---------
 AAA AAA
 AAA_AAA
 BBB AAB
 BBB_AAA
(4 rows)

-- Daniele


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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #8118: Wrong sorting text
@ 2013-04-29 11:00  whiplash <whiplash@bss.org.ua>
  parent: Daniele Varrazzo <daniele.varrazzo@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: whiplash @ 2013-04-29 11:00 UTC (permalink / raw)
  To: Daniele Varrazzo <daniele.varrazzo@gmail.com>; +Cc: Jov <amutu@amutu.com>; pgsql-bugs

Thank you, works fine.
>>> Bug reference:      8118
>>> Logged by:          whiplash
>>> Email address:whiplash@bss.org.ua
>>> PostgreSQL version: 9.2.2
>>> Operating system:   Linux (Fedora 11, Fedora 16 and Ubuntu 12.04)
>>> Description:
>>>
>>> I execute query (1):
>>>
>>> SELECT t.name
>>> FROM
>>> (
>>>      SELECT 'AAA AAA' AS name
>>>      UNION ALL
>>>      SELECT 'AAA_AAA'
>>>      UNION ALL
>>>      SELECT 'BBB_AAA'
>>>      UNION ALL
>>>      SELECT 'BBB AAB'
>>> ) t
>>> ORDER BY t.name
>>>
>>> and I getting a result:
>>>
>>> AAA AAA
>>> AAA_AAA
>>> BBB_AAA
>>> BBB AAB
> It's a matter of collate. If you want ascii ordering specify collate "C".
>
> ...
> ORDER BY t.name collate "C";
>    name
> ---------
>   AAA AAA
>   AAA_AAA
>   BBB AAB
>   BBB_AAA
> (4 rows)
>
> -- Daniele
>



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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2013-04-29 11:00 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-04-26 18:36 BUG #8118: Wrong sorting text whiplash@bss.org.ua
2013-04-27 04:04 ` Jov <amutu@amutu.com>
2013-04-28 21:05   ` Daniele Varrazzo <daniele.varrazzo@gmail.com>
2013-04-29 11:00     ` whiplash <whiplash@bss.org.ua>

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