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