nth_value out of more than n values returns null - Mailing list pgsql-general

From Guyren Howe
Subject nth_value out of more than n values returns null
Date
Msg-id 3ed0759d-c332-4f96-a147-499a694e9204@Spark
Whole thread Raw
Responses Re: nth_value out of more than n values returns null
Re: nth_value out of more than n values returns null
List pgsql-general
This query:

SELECT NTH_VALUE(id, 5000000) OVER (ORDER BY created_at, id ASC) FROM table

in a table where SELECT COUNT(*) returns a value a few thousand over 5 million, where id is the primary key, returns null.

The inclusion of the primary key should make the order by a total order. So there should be a 5 millionth row.

How can this happen?

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Column name beginning with underscore ("_")?
Next
From: Adrian Klaver
Date:
Subject: Re: nth_value out of more than n values returns null