{"Entry":{"collection":"func","key":"lastval","name":"lastval","aliases":[],"metadata":{"changed_in":[],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"8.0","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"8.1"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"0b13e9dcaa5049605c63f08399ec9df6f48a82fe047c26d50195bc861db1f689","first_version":"8.1","group":"sequence","group_label":"Sequence Manipulation Functions","groups":["sequence"],"imported_at":"2026-09-27T17:57:28.843461+08:00","last_version":"20","name":"lastval","name_key":"lastval","position":17001,"present_in":["8.1","8.2","8.3","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"],"signature":"lastval () → bigint","signature_count":1,"slug":"lastval","source_rev":"b7bd9cda","summary":"Returns the value most recently returned by nextval in the current session.","summary_zh":""}},"Definition":{"Collection":"func","Key":"lastval","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"lastval","SourceRevision":"b7bd9cda","Facts":{"description":"Returns the value most recently returned by nextval in the current session. This function is identical to currval, except that instead of taking the sequence name as an argument it refers to whichever sequence nextval was most recently applied to in the current session. It is an error to call lastval if nextval has not yet been called in the current session.","description_html":"Returns the value most recently returned by \u003ccode class=\"function\"\u003enextval\u003c/code\u003e in the current session. This function is identical to \u003ccode class=\"function\"\u003ecurrval\u003c/code\u003e, except that instead of taking the sequence name as an argument it refers to whichever sequence \u003ccode class=\"function\"\u003enextval\u003c/code\u003e was most recently applied to in the current session. It is an error to call \u003ccode class=\"function\"\u003elastval\u003c/code\u003e if \u003ccode class=\"function\"\u003enextval\u003c/code\u003e has not yet been called in the current session.","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-SEQUENCE-TABLE","file":"functions-sequence.html","slug":"18"},"group":"sequence","group_label":"Sequence Manipulation Functions","lang":"en","layout":"table-new","pages":["functions-sequence.html"],"prose_only":false,"signatures":[{"description":"Returns the value most recently returned by nextval in the current session. This function is identical to currval, except that instead of taking the sequence name as an argument it refers to whichever sequence nextval was most recently applied to in the current session. It is an error to call lastval if nextval has not yet been called in the current session.","description_html":"Returns the value most recently returned by \u003ccode class=\"function\"\u003enextval\u003c/code\u003e in the current session. This function is identical to \u003ccode class=\"function\"\u003ecurrval\u003c/code\u003e, except that instead of taking the sequence name as an argument it refers to whichever sequence \u003ccode class=\"function\"\u003enextval\u003c/code\u003e was most recently applied to in the current session. It is an error to call \u003ccode class=\"function\"\u003elastval\u003c/code\u003e if \u003ccode class=\"function\"\u003enextval\u003c/code\u003e has not yet been called in the current session.","description_zh":"","description_zh_html":"","examples":[],"html":"\u003ccode class=\"function\"\u003elastval\u003c/code\u003e () → \u003ccode class=\"returnvalue\"\u003ebigint\u003c/code\u003e","returns":"bigint","text":"lastval () → bigint","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-SEQUENCE-TABLE","file":"functions-sequence.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"lastval","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"lastval","Summary":"返回nextval在当前会话中最近返回的值。这个函数与currval相同，不同之处在于它没有使用序列名作为参数，而是引用当前会话中nextval最近应用到的序列。如果在当前会话中还没有调用nextval，那么调用lastval是一个错误。","BodyHTML":"返回\u003ccode\u003enextval\u003c/code\u003e在当前会话中最近返回的值。这个函数与\u003ccode\u003ecurrval\u003c/code\u003e相同，不同之处在于它没有使用序列名作为参数，而是引用当前会话中\u003ccode\u003enextval\u003c/code\u003e最近应用到的序列。如果在当前会话中还没有调用\u003ccode\u003enextval\u003c/code\u003e，那么调用\u003ccode\u003elastval\u003c/code\u003e是一个错误。\u003cpre\u003elastval () → bigint\u003c/pre\u003e返回\u003ccode\u003enextval\u003c/code\u003e在当前会话中最近返回的值。这个函数与\u003ccode\u003ecurrval\u003c/code\u003e相同，不同之处在于它没有使用序列名作为参数，而是引用当前会话中\u003ccode\u003enextval\u003c/code\u003e最近应用到的序列。如果在当前会话中还没有调用\u003ccode\u003enextval\u003c/code\u003e，那么调用\u003ccode\u003elastval\u003c/code\u003e是一个错误。","SourceRevision":"ca936764","ContentHash":"aa26bc2348153500fdf0f32918aad18d0a783d80f12828ec325e6feb8ffdc91d","Payload":{"description_zh":"返回nextval在当前会话中最近返回的值。这个函数与currval相同，不同之处在于它没有使用序列名作为参数，而是引用当前会话中nextval最近应用到的序列。如果在当前会话中还没有调用nextval，那么调用lastval是一个错误。","description_zh_html":"返回\u003ccode class=\"function\"\u003enextval\u003c/code\u003e在当前会话中最近返回的值。这个函数与\u003ccode class=\"function\"\u003ecurrval\u003c/code\u003e相同，不同之处在于它没有使用序列名作为参数，而是引用当前会话中\u003ccode class=\"function\"\u003enextval\u003c/code\u003e最近应用到的序列。如果在当前会话中还没有调用\u003ccode class=\"function\"\u003enextval\u003c/code\u003e，那么调用\u003ccode class=\"function\"\u003elastval\u003c/code\u003e是一个错误。","signatures":[{"description_zh":"返回nextval在当前会话中最近返回的值。这个函数与currval相同，不同之处在于它没有使用序列名作为参数，而是引用当前会话中nextval最近应用到的序列。如果在当前会话中还没有调用nextval，那么调用lastval是一个错误。","description_zh_html":"返回\u003ccode class=\"function\"\u003enextval\u003c/code\u003e在当前会话中最近返回的值。这个函数与\u003ccode class=\"function\"\u003ecurrval\u003c/code\u003e相同，不同之处在于它没有使用序列名作为参数，而是引用当前会话中\u003ccode class=\"function\"\u003enextval\u003c/code\u003e最近应用到的序列。如果在当前会话中还没有调用\u003ccode class=\"function\"\u003enextval\u003c/code\u003e，那么调用\u003ccode class=\"function\"\u003elastval\u003c/code\u003e是一个错误。","returns":"bigint","text":"lastval () → bigint","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.1","8.2","8.3","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":"bc1242eb53bfbc126e084864881a06e0062a81c9508c5fdd78a29ee589896797","Text":"lastval () → bigint","Returns":"bigint","Payload":{"description":"Returns the value most recently returned by nextval in the current session. This function is identical to currval, except that instead of taking the sequence name as an argument it refers to whichever sequence nextval was most recently applied to in the current session. It is an error to call lastval if nextval has not yet been called in the current session.","description_html":"Returns the value most recently returned by \u003ccode class=\"function\"\u003enextval\u003c/code\u003e in the current session. This function is identical to \u003ccode class=\"function\"\u003ecurrval\u003c/code\u003e, except that instead of taking the sequence name as an argument it refers to whichever sequence \u003ccode class=\"function\"\u003enextval\u003c/code\u003e was most recently applied to in the current session. It is an error to call \u003ccode class=\"function\"\u003elastval\u003c/code\u003e if \u003ccode class=\"function\"\u003enextval\u003c/code\u003e has not yet been called in the current session.","description_zh":"","description_zh_html":"","examples":[],"html":"\u003ccode class=\"function\"\u003elastval\u003c/code\u003e () → \u003ccode class=\"returnvalue\"\u003ebigint\u003c/code\u003e","returns":"bigint","text":"lastval () → bigint","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
