> "Tom" == Tom Lane writes:
>> I wonder if it would be worth adding a run-time check in
>> window_ntile() that causes an ERROR on first call if there are any
>> Vars or PARAM_EXEC Params in the function argument. An ERROR might
>> be better than doing something that the user does not expe
David Rowley writes:
> On 14 June 2018 at 18:57, Andrew Gierth wrote:
>> What I think pg is actually doing is taking the value of the ntile()
>> argument from the first row and using that for the whole partition.
Yes, easily verified by looking at window_ntile(): the argument is only
examined on
On 14 June 2018 at 18:57, Andrew Gierth wrote:
> What I think pg is actually doing is taking the value of the ntile()
> argument from the first row and using that for the whole partition.
> In your example, enabling or disabling hashagg changes the order of the
> input rows for the window function
>>>>> "Rajkumar" == Rajkumar Raghuwanshi
>>>>> writes:
Rajkumar> Hi
Rajkumar> ntile() throws ERROR when hashagg is false, test case given
Rajkumar> below.
Rajkumar> postgres=# create table foo (a int, b int, c text);
Rajkumar> CREA
Hi
ntile() throws ERROR when hashagg is false, test case given below.
postgres=# create table foo (a int, b int, c text);
CREATE TABLE
postgres=# insert into foo select i%20, i%30, to_char(i%12, 'FM') from
generate_series(0, 36) i;
INSERT 0 37
postgres=# explain select ntile(a) OV