Re: New Window Function: ROW_NUMBER_DESC() OVER() ? - Mailing list pgsql-hackers

From Michał Kłeczek
Subject Re: New Window Function: ROW_NUMBER_DESC() OVER() ?
Date
Msg-id 081D9B3E-A106-49E0-AA0E-EE9A09E3B7CC@kleczek.org
Whole thread Raw
In response to RE: New Window Function: ROW_NUMBER_DESC() OVER() ?  (Maiquel Grassi <grassi@hotmail.com.br>)
Responses RE: New Window Function: ROW_NUMBER_DESC() OVER() ?
RE: New Window Function: ROW_NUMBER_DESC() OVER() ?
Re: New Window Function: ROW_NUMBER_DESC() OVER() ?
List pgsql-hackers


On 16 Jan 2024, at 16:51, Maiquel Grassi <grassi@hotmail.com.br> wrote:


Imagine I have a dataset that is returned to my front-end, and I want to reverse enumerate them (exactly the concept of Math enumerating integers). The row_number does the ascending enumeration, but I need the descending enumeration.

You can do:

-(ROW_NUMBER() OVER ()) AS descending

(note “-“ in front)

I don't have a base column to use for "order by,"

I think that’s the main issue: what (semantically) does row_number() mean in that case? You could equally well generate random numbers?


— 
Michal

pgsql-hackers by date:

Previous
From: Maiquel Grassi
Date:
Subject: RE: New Window Function: ROW_NUMBER_DESC() OVER() ?
Next
From: "David G. Johnston"
Date:
Subject: New Window Function: ROW_NUMBER_DESC() OVER() ?