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

From Tom Lane
Subject Re: BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly
Date
Msg-id 1355101.1594043329@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> -- 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;

Note that "c[0]" is a constant NULL in this example, so all the
rows fall into the same partition.

> -- 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;

In this case, rows with distinct "a" values belong to different
partitions.  Every row in a particular partition has the same "a"
value, so it's expected that they all have rank 1.

In short, I see no bug here.  "PARTITION BY a ORDER BY a" just
isn't a very useful window specification (independently of what
"a" is ...)

            regards, tom lane



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly
Next
From: Tom Lane
Date:
Subject: Re: [bug] Table not have typarray when created by single user mode