PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16528
PG Version11.8
OSUbuntu 18.04.1 LTS
Opened2020-07-06 12:28:29+00
Reported byManvendra Panwar
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16528
Logged by:          Manvendra Panwar
Email address:      (redacted)
PostgreSQL version: 11.8
Operating system:   Ubuntu 18.04.1 LTS
Description:        

postgres=# create table array_order (a int[], b float[], c bool[]);
CREATE TABLE
postgres=# insert into array_order values
(array[935,181,326,103],array[38766.318,54516.453,9546.79,276.63],array[false,true]);
INSERT 0 1
postgres=# insert into array_order values
(array[935,181,326,103],array[38767.318,54517.453,9540.79,270.63],array[false,true]);
INSERT 0 1
postgres=# insert into array_order values
(array[935,181,326,104],array[38767.348,54517.443,9540.49,270.43],array[true]
     );
INSERT 0 1
postgres=# commit;

postgres=# select * from array_order;
         a         |                  b                   |   c
-------------------+--------------------------------------+-------
 {935,181,326,103} | {38766.318,54516.453,9546.79,276.63} | {f,t}
 {935,181,326,103} | {38767.318,54517.453,9540.79,270.63} | {f,t}
 {935,181,326,104} | {38767.348,54517.443,9540.49,270.43} | {t}
(3 rows)

-- WORKING FINE with ARRAY element
postgres=# SELECT a , b, RANK() OVER (PARTITION BY c[0] ORDER BY a) Rank,
DENSE_RANK() OVER (PARTITION BY c[0] ORDER BY a) "Dense Rank"  FROM
array_order order by 3;
         a         |                  b                   | rank | Dense
Rank
-------------------+--------------------------------------+------+------------
 {935,181,326,103} | {38766.318,54516.453,9546.79,276.63} |    1 |         
1
 {935,181,326,103} | {38767.318,54517.453,9540.79,270.63} |    1 |         
1
 {935,181,326,104} | {38767.348,54517.443,9540.49,270.43} |    3 |         
2
(3 rows)

-- WITH ARRAY in PARTITION BY CLAUSE
postgres=# SELECT a , b, RANK() OVER (PARTITION BY a ORDER BY a) Rank,
DENSE_RANK() OVER (PARTITION BY a ORDER BY a) "Dense Rank"  FROM array_order
order by 3;
         a         |                  b                   | rank | Dense
Rank
-------------------+--------------------------------------+------+------------
 {935,181,326,103} | {38766.318,54516.453,9546.79,276.63} |    1 |         
1
 {935,181,326,103} | {38767.318,54517.453,9540.79,270.63} |    1 |         
1
 {935,181,326,104} | {38767.348,54517.443,9540.49,270.43} |    1 |         
1
(3 rows)

Messages

DateAuthorSubject
2020-07-06 12:28:29+00PG Bug reporting formBUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly
2020-07-06 13:48:49+00Tom LaneRe: BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly