Wiki / Functions
lag
Returns value evaluated at the row that is offset rows before the current row within the partition; if there is no such row, instead returns default (which must be of a type compatible with value). Both offset and default are evaluated with respect to the current row. If omitted, offset defaults to 1 and default to NULL.
English manual coverage begins with PostgreSQL 7.1. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- group
- window
- group label
- Window Functions
- lang
- en
- layout
- table-new
- pages
- functions-window.html
- prose only
- false