BUG #17168: Incorrect sorting

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #17168: Incorrect sorting
Дата
Msg-id 17168-ba6f8f2c7dab4282@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #17168: Incorrect sorting  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17168
Logged by:          Alfonso Vicente
Email address:      alfonsovicente@gmail.com
PostgreSQL version: 13.2
Operating system:   Red Hat Enterprise Linux 8
Description:

This is a minimal example to reproduce the error, the "ara" tuple is
incorrectly sorted between "a r" and "a s"

test=> with s1 as (select 'a r' c), s2 as (select 'ara' c), s3 as (select 'a
s' c) select c from (select c from s1 union all select c from s2 union all
select c from s3) as foo order by 1;
  c  
-----
 a r
 ara
 a s
(3 rows)

It appears to be related with spaces, here are two examples that shows the
same problem with the "ara" and "aja" strings

Example 1
------------------

test=> with s1 as (select 'a r' c), s2 as (select 'ara' c), s3 as (select 'a
q' c) select c from (select c from s1 union all select c from s2 union all
select c from s3) as foo order by 1;
  c  
-----
 a q
 a r
 ara
(3 rows)

test=> with s1 as (select 'a r' c), s2 as (select 'ara' c), s3 as (select 'a
r' c) select c from (select c from s1 union all select c from s2 union all
select c from s3) as foo order by 1;
  c  
-----
 a r
 a r
 ara
(3 rows)

test=> with s1 as (select 'a r' c), s2 as (select 'ara' c), s3 as (select 'a
s' c) select c from (select c from s1 union all select c from s2 union all
select c from s3) as foo order by 1;
  c  
-----
 a r
 ara
 a s
(3 rows)

Example 2
------------------

test=> with s1 as (select 'a j' c), s2 as (select 'aja' c), s3 as (select 'a
i' c) select c from (select c from s1 union all select c from s2 union all
select c from s3) as foo order by 1;
  c  
-----
 a i
 a j
 aja
(3 rows)

test=> with s1 as (select 'a j' c), s2 as (select 'aja' c), s3 as (select 'a
j' c) select c from (select c from s1 union all select c from s2 union all
select c from s3) as foo order by 1;
  c  
-----
 a j
 a j
 aja
(3 rows)

test=> with s1 as (select 'a j' c), s2 as (select 'aja' c), s3 as (select 'a
k' c) select c from (select c from s1 union all select c from s2 union all
select c from s3) as foo order by 1;
  c  
-----
 a j
 aja
 a k
(3 rows)


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Jeremy Spray
Дата:
Сообщение: Postgres bug report
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Postgres bug report