Select Row number in postgres Select Row number in postgres postgresql postgresql

Select Row number in postgres


SELECT tab.*,    row_number() OVER () as rnum  FROM tab;

Here's the relevant section in the docs.

P.S. This, in fact, fully matches the answer in the referenced question.