BUG #16548: Order by on array element giving disparity in result

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: manvendra2525(at)gmail(dot)com
Subject: BUG #16548: Order by on array element giving disparity in result
Date: 2020-07-21 12:52:45
Message-ID: 16548-d48610c6070e8ca7@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16548
Logged by: Manvendra Panwar
Email address: manvendra2525(at)gmail(dot)com
PostgreSQL version: 12.2
Operating system: Ubuntu 18.04.1 LTS
Description:

create table bint (a int[]);
insert into bint values (array[14]);
insert into bint values (array[14]);
insert into bint values (array[10]);
insert into bint values (array[10,14,14,14]);
insert into bint values (array[10,14,10,10]);
insert into bint values (array[14,14,10,14]);
insert into bint values (array[10,14,14,14]);
insert into bint values (array[10,14]);
insert into bint values (array[10,14]);
insert into bint values (array[14,14,14,14]);
insert into bint values (array[10,14,10,10]);
insert into bint values (array[10,14]);
insert into bint values (array[10,14]);
insert into bint values (array[10,14]);
insert into bint values (array[10,14]);
insert into bint values (array[10,14]);
insert into bint values (array[14,14,14,10]);
insert into bint values (array[14,14,14,10]);
insert into bint values (array[14,14,14,14]);
insert into bint values (array[10,14]);
insert into bint values (array[10,14]);
insert into bint values (array[10,14,14,14]);
insert into bint values (array[10,14]);
commit;

postgres=# select * from bint order by a[2] desc;
a
---------------
{14}
{14}
{10}
{10,14,14,14}
{10,14,10,10}
{14,14,10,14}
{10,14,14,14}
{10,14}
{10,14}
{14,14,14,14}
{10,14,10,10}
{10,14}
{10,14}
{10,14}
{10,14}
{10,14}
{14,14,14,10}
{14,14,14,10}
{14,14,14,14}
{10,14}
{10,14}
{10,14,14,14}
{10,14}
(23 rows)

postgres=# select * from bint order by a[2] desc limit 5;
a
---------------
{14}
{10}
{14}
{10,14,10,10}
{10,14,14,14}
(5 rows)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kieran McCusker 2020-07-21 13:25:16 Re: BUG #16548: Order by on array element giving disparity in result
Previous Message Panchal, Avanish 2020-07-21 10:47:34 Bug - 11.8