Re: BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: manvendra2525(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly
Date: 2020-07-06 13:48:49
Message-ID: 1355101.1594043329@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-07-06 20:22:39 Re: [bug] Table not have typarray when created by single user mode
Previous Message PG Bug reporting form 2020-07-06 12:28:29 BUG #16528: Analytical function with Over clause for ARRAY datatype is not working properly