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

From David G. Johnston
Subject Re: New Window Function: ROW_NUMBER_DESC() OVER() ?
Date
Msg-id CAKFQuwbVkUj5A=VYykE=81x_WKyhpgutXuqpiRSQ=a6kL6V2bw@mail.gmail.com
Whole thread Raw
In response to New Window Function: ROW_NUMBER_DESC() OVER() ?  (Maiquel Grassi <grassi@hotmail.com.br>)
Responses RE: New Window Function: ROW_NUMBER_DESC() OVER() ?
List pgsql-hackers
On Tuesday, January 16, 2024, Maiquel Grassi <grassi@hotmail.com.br> wrote:
Hi developers,

I was working on loans and bank financing, specifically focusing on Amortization Systems. I had the need to reverse the counter for the total number of installments or for a specific set of installments. This "reversal" is essentially a reverse "row_number" function. I realized that it is to "hard work" to write PL/foo functions for this or even to implement it in just SQL using little code.

I think “row_number() over (order by … desc)”  is a sufficient way to get this behavior and this isn’t something useful enough to warrant being the first ordering-specific function in the system.

David J.

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Postgres Database Service Interruption
Next
From: Jelte Fennema-Nio
Date:
Subject: Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs