Re: window functions maybe bug - Mailing list pgsql-hackers

From Tom Lane
Subject Re: window functions maybe bug
Date
Msg-id 2958.1251902814@sss.pgh.pa.us
Whole thread Raw
In response to window functions maybe bug  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: window functions maybe bug
List pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> create table x1 (a integer);
> insert into x1 values(2),(2),(3),(3),(4),(4),(5),(5),(6),(6),(6),(8),(9),(9),(10),(10);

> postgres=# select row_number() over (order by a), row_number() over
> (order by a desc) from x1;
>  row_number | row_number
> ------------+------------
>          16 |          1
>          15 |          2
>          14 |          3
>          11 |          4
>          13 |          5
>          12 |          6
>           9 |          7
>          10 |          8
>           7 |          9
>           8 |         10
>           5 |         11
>           6 |         12
>           4 |         13
>           3 |         14
>           1 |         15
>           2 |         16
> (16 rows)

> I am not sure, is this correct?

I don't see any grounds for arguing that it's wrong.  The results for
rows with equal "a" values are indeterminate.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: A bug in scan.l
Next
From: "Kevin Grittner"
Date:
Subject: Re: Linux LSB init script