↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Functions / Window Functions

Returns value evaluated at the row that is offset rows after the current row within the partition; if there is no such row, instead returns default (which must be of a type compatible with value).

Reading PG 18current·documented in 19 of 27 versions, 8.4 to 20

Signatures & examples

lead ( value anycompatible [, offset integer [, default anycompatible ]] ) → anycompatible
Returns value evaluated at the row that is offset rows after 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.
Version history 5
  1. 18 → 19 changed
  2. 13 → 14 changed
  3. 12 → 13 changed
  4. 8.4 → 9.0 changed
  5. 8.3 → 8.4 added

Definition snapshot: b7bd9cda · English manual source