{"Entry":{"collection":"func","key":"lead","name":"lead","aliases":[],"metadata":{"changed_in":["9.0","14","19"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"8.3","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"8.4"},{"descriptions_changed":true,"doc_overhaul":false,"from":"8.4","group_changed":null,"signatures":{"added":["lead ( value anyelement [, offset integer [, default anyelement ]] ) → same type as value"],"removed":["lead ( value any [, offset integer [, default any ]] ) → same type as value"]},"status":"changed","to":"9.0"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"},{"descriptions_changed":true,"doc_overhaul":false,"from":"13","group_changed":null,"signatures":{"added":["lead ( value anycompatible [, offset integer [, default anycompatible ]] ) → anycompatible"],"removed":["lead ( value anyelement [, offset integer [, default anyelement ]] ) → anyelement"]},"status":"changed","to":"14"},{"descriptions_changed":false,"doc_overhaul":false,"from":"18","group_changed":null,"signatures":{"added":["lead ( value anycompatible [, offset integer [, default anycompatible ]] ) [ null treatment ] → anycompatible"],"removed":["lead ( value anycompatible [, offset integer [, default anycompatible ]] ) → anycompatible"]},"status":"changed","to":"19"}],"content_hash":"0dc729eeb8acf82847675917b5ada5f34b615878fb143f039318888ac7ab9044","derived_content_hash":"ee7bc40ff888b219d532d0d6079e925311033a4fbdfc728419a89b126c4181d1","first_version":"8.4","group":"window","group_label":"Window Functions","groups":["window"],"imported_at":"2026-09-27T17:57:28.997837+08:00","last_version":"20","name":"lead","name_key":"lead","position":22003,"present_in":["8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"b7bd9cda","receipt_sha256":"7b309bb7a27e7cbe67f663a5e1c8615298a095f93f42578c7b74e0362cd95a68","repair":"wiki-repair-20261023"},"signature":"lead ( value anycompatible [, offset integer [, default anycompatible ]] ) [ null treatment ] → anycompatible","signature_count":1,"slug":"lead","source_rev":"wiki-repair-20261023:29321d15f203503adad6f1b0dced759834860464edda0167f836a115dcd5f1ca","summary":"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).","summary_zh":""}},"Definition":{"Collection":"func","Key":"lead","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"lead","SourceRevision":"wiki-repair-20261023:29321d15f203503adad6f1b0dced759834860464edda0167f836a115dcd5f1ca","Facts":{"description":"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.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e evaluated at the row that is \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e rows after the current row within the partition; if there is no such row, instead returns \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e (which must be of a type compatible with \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e). Both \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e are evaluated with respect to the current row. If omitted, \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e defaults to 1 and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"返回在分区内当前行之后 offset 行处计算的 value；如果没有这样的行，则返回 default（其类型必须与 value 兼容）。offset 和 default 都针对当前行求值。如果省略，offset 默认为 1，default 默认为 NULL。","description_zh_html":"返回在分区内当前行之后 \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 行处计算的 \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e；如果没有这样的行，则返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e（其类型必须与 \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 兼容）。\u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e 都针对当前行求值。如果省略，\u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 默认为 1，\u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e 默认为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","doc":{"anchor":"FUNCTIONS-WINDOW-TABLE","file":"functions-window.html","slug":"18"},"group":"window","group_label":"Window Functions","lang":"en","layout":"table-new","pages":["functions-window.html"],"prose_only":false,"signatures":[{"description":"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.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e evaluated at the row that is \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e rows after the current row within the partition; if there is no such row, instead returns \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e (which must be of a type compatible with \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e). Both \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e are evaluated with respect to the current row. If omitted, \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e defaults to 1 and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"返回在分区内当前行之后 offset 行处计算的 value；如果没有这样的行，则返回 default（其类型必须与 value 兼容）。offset 和 default 都针对当前行求值。如果省略，offset 默认为 1，default 默认为 NULL。","description_zh_html":"返回在分区内当前行之后 \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 行处计算的 \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e；如果没有这样的行，则返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e（其类型必须与 \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 兼容）。\u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e 都针对当前行求值。如果省略，\u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 默认为 1，\u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e 默认为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","examples":[],"html":"\u003ccode class=\"function\"\u003elead\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eanycompatible\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eanycompatible\u003c/code\u003e\u003c/span\u003e ]\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003eanycompatible\u003c/code\u003e","returns":"anycompatible","text":"lead ( value anycompatible [, offset integer [, default anycompatible ]] ) → anycompatible","zh_from":"same-version-pgdoc"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-window.html","sha256":"859f0e20306eeaf9a15406f95e01cb81a166cfbe2fd21534fc44df3f903b4e6d"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-WINDOW-TABLE","file":"functions-window.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"lead","SourceDatabase":"center","Version":"18","Locale":"en","Title":"lead","Summary":"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.","BodyHTML":"Returns \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e evaluated at the row that is \u003cem\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e rows after the current row within the partition; if there is no such row, instead returns \u003cem\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e (which must be of a type compatible with \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e). Both \u003cem\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e and \u003cem\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e are evaluated with respect to the current row. If omitted, \u003cem\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e defaults to 1 and \u003cem\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e to \u003ccode\u003eNULL\u003c/code\u003e.","SourceRevision":"wiki-repair-20261023:29321d15f203503adad6f1b0dced759834860464edda0167f836a115dcd5f1ca","ContentHash":"b1ebf6de4c60e72632ab3dfd4b449d8adaf84742dab489473736df19b313614c","Payload":{"description":"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.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e evaluated at the row that is \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e rows after the current row within the partition; if there is no such row, instead returns \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e (which must be of a type compatible with \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e). Both \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e are evaluated with respect to the current row. If omitted, \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e defaults to 1 and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","signatures":[{"description":"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.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e evaluated at the row that is \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e rows after the current row within the partition; if there is no such row, instead returns \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e (which must be of a type compatible with \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e). Both \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e are evaluated with respect to the current row. If omitted, \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e defaults to 1 and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"返回在分区内当前行之后 offset 行处计算的 value；如果没有这样的行，则返回 default（其类型必须与 value 兼容）。offset 和 default 都针对当前行求值。如果省略，offset 默认为 1，default 默认为 NULL。","description_zh_html":"返回在分区内当前行之后 \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 行处计算的 \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e；如果没有这样的行，则返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e（其类型必须与 \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 兼容）。\u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e 都针对当前行求值。如果省略，\u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 默认为 1，\u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e 默认为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","examples":[],"html":"\u003ccode class=\"function\"\u003elead\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eanycompatible\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eanycompatible\u003c/code\u003e\u003c/span\u003e ]\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003eanycompatible\u003c/code\u003e","returns":"anycompatible","text":"lead ( value anycompatible [, offset integer [, default anycompatible ]] ) → anycompatible","zh_from":"same-version-pgdoc"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"b9704571f5083e0e5217dea540053f7a18807739a2bd898fa092e262d0da40ed","Text":"lead ( value anycompatible [, offset integer [, default anycompatible ]] ) → anycompatible","Returns":"anycompatible","Payload":{"description":"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.","description_html":"Returns \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e evaluated at the row that is \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e rows after the current row within the partition; if there is no such row, instead returns \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e (which must be of a type compatible with \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e). Both \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e are evaluated with respect to the current row. If omitted, \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e defaults to 1 and \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"返回在分区内当前行之后 offset 行处计算的 value；如果没有这样的行，则返回 default（其类型必须与 value 兼容）。offset 和 default 都针对当前行求值。如果省略，offset 默认为 1，default 默认为 NULL。","description_zh_html":"返回在分区内当前行之后 \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 行处计算的 \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e；如果没有这样的行，则返回 \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e（其类型必须与 \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 兼容）。\u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e 都针对当前行求值。如果省略，\u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e 默认为 1，\u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e 默认为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","examples":[],"html":"\u003ccode class=\"function\"\u003elead\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eanycompatible\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eoffset\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eanycompatible\u003c/code\u003e\u003c/span\u003e ]\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003eanycompatible\u003c/code\u003e","returns":"anycompatible","text":"lead ( value anycompatible [, offset integer [, default anycompatible ]] ) → anycompatible","zh_from":"same-version-pgdoc"}}],"Spellings":null,"SQLState":null,"Evidence":null}
