BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly
Date
Msg-id 16528-8ddc2c3ee591a2bb@postgresql.org
Whole thread Raw
Responses Re: BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16528
Logged by:          Manvendra Panwar
Email address:      manvendra2525@gmail.com
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)


pgsql-bugs by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: BUG #16500: SQL Abend. select multi_key_columns_range_partition_table
Next
From: Tom Lane
Date:
Subject: Re: BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly