22023 — invalid_parameter_value
参数或选项取值超出允许范围。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Data Exception
- condition name
- invalid_parameter_value
- lang
- en
- sqlstate
- 22023
版本定义 PG 18
22023
速览 {#at-a-glance}
当点名的参数、选项、描述符或函数参数超出所属实现的值域时会使用本码。固定代表包括内置 GUC 解析、amcheck 描述符/选项、postgres_fdw 选项校验和正则选项检查;首要报文会指出归属和数值。
保留的 PostgreSQL 18.6 与 10.21 观察使用同一自动提交案例:SET work_mem = 'not-a-memory-size' 返回 SQLSTATE 22023 和 invalid value for parameter "work_mem": "not-a-memory-size";SET work_mem = '1MB' 修复,SHOW work_mem 返回 1MB。两个后端在错误和修复后均为 IDLE。该案例只绑定内置 GUC 路径,不代表所有 22023 归属;见公共 case JSON。
SET work_mem = 'not-a-memory-size';
SET work_mem = '1MB';
SHOW work_mem;
代表性报文 {#messages}
这些示例共用 22023,但属于不同归属:
| 归属/路径 | 代表性首要文本 |
| --- | --- |
| 内置 GUC 解析/检查 | parameter "%s" requires a Boolean value;invalid value for parameter "%s": "%s" |
| verify_heapam | relation cannot be null;invalid skip option — HINT:Valid skip options are "all-visible", "all-frozen", and "none". |
| postgres_fdw | invalid value for floating point option "%s": %s;invalid value for integer option "%s": %s |
| 正则选项解析器 | invalid regular expression option: "%.*s" |
含义 {#meaning}
22023 是多个参数校验机制共用的代码,实际机制取决于报文指出的归属。内置 GUC 先把 Boolean、整数、实数、字符串或 enum 转换,检查整数/实数范围和 B/MB 或时间单位,再调用参数专属 check hook;设置上下文和权限是独立约束。verify_heapam 则检查必填非 NULL 描述符和枚举式 skip 值,postgres_fdw 解析数值/字符串选项与正值边界,regexp 函数校验 option 字母或函数参数。这些组共享 SQLSTATE,却不共享一个通用值域。
诊断 {#diagnosis}
先按首要报文定位命令、函数或扩展。对于 GUC,检查参数类型、允许单位/范围以及当前设置上下文;对于扩展或函数,按其自身选项和边界处理。上面的 work_mem 只证明错误 GUC 值与带单位修复值的一条路径,不能用来推断 amcheck、postgres_fdw、regexp 或其他参数的修复。
处理 {#response}
按所属参数的文档值域修正值,必要时同时修正单位和设置上下文。显式事务中的语句级 ERROR 后,必须 ROLLBACK 或 ROLLBACK TO SAVEPOINT 才能继续;自动提交客户端可重试修正后的动作。保留的自动提交案例中,同一后端在错误和修复后保持 IDLE。
版本 {#versions}
锁定目录从 7.4 起记录该条件;固定源码覆盖 PostgreSQL 18.6。保留的观察覆盖 PostgreSQL 18.6 与 10.21 上述 work_mem 案例。
相关 {#related}
来源 {#sources}
内置 GUC 转换/范围/check-hook 路径见 src/backend/utils/misc/guc.c#L3129-3320 与 #L6804-6990;单位表见 #L87-181,设置上下文处理见 #L3342-3430,另见 contrib/amcheck/verify_heapam.c#L271-303、contrib/postgres_fdw/option.c#L149-185、src/backend/utils/adt/regexp.c#L443-446。结构化证据记录保留确切报文、运行摘要和各归属边界。
比较版本
SQLSTATE 证据与已记录的运行版本
cases · invalid_work_mem_parameter
{
"assertions": [
"SQLSTATE is 22023 with the invalid work_mem value diagnostic",
"The failed autocommit session remains IDLE",
"A valid work_mem value is accepted in the same session and SHOW reports 1MB"
],
"case_id": "invalid_work_mem_parameter",
"cleanup": "Close the runner connection and drop the case schema with an owner connection.",
"has_snippet": true,
"position": 0,
"preconditions": [
"A runner-owned disposable target is provisioned."
],
"repair": "Set work_mem to a valid memory value in the same session; do not interpret a parameter-value error as a connection failure.",
"trigger": "Set the built-in work_mem parameter to the invalid memory-size text not-a-memory-size.",
"versions": [
"10",
"18"
]
}claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read the fixed errcodes row and macro.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "22023 is invalid_parameter_value in SQLSTATE Class 22"
}claims · resolved-path
{
"claim_id": "resolved-path",
"limits": "Source confirmation is not a natural runtime observation.",
"method": "Read complete source contexts for the representative guards.",
"position": 1,
"runtime": [],
"sources": [
"src.amcheck",
"src.postgres_fdw",
"src.regexp.options",
"src.guc.parse",
"src.guc.hooks",
"src.guc.units",
"src.guc.context"
],
"statement": "Fixed PostgreSQL 18.6 representatives bind owner-specific NULL/option/range checks and built-in GUC parse/range/unit/context/check-hook paths."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue presence and history boundaries.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 22023 from 7.4 without proving an exact implementation introduction date."
}claims · runtime.observation
{
"claim_id": "runtime.observation",
"limits": "The observation covers the named GUC case and does not generalize to every 22023 owner.",
"method": "Read both retained summaries, raw digests, and the fixed snippet registry.",
"position": 3,
"runtime": [],
"sources": [
"runtime.22023-work-mem-latest.latest",
"runtime.22023-work-mem-pg10.pg10",
"snippet-registry.22023"
],
"statement": "The retained invalid_work_mem_parameter case passed on PostgreSQL 18.6 and 10.21 with the observed message and repair described on the page."
}messages · message.0
{
"limits": "",
"message_id": "message.0",
"path": "",
"position": 0,
"raw": {
"id": "message.0",
"primary_template": "relation cannot be null",
"severity_source": "ERROR",
"sources": [
"src.amcheck"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.amcheck"
],
"templates": [
{
"kind": "primary",
"literal": "relation cannot be null",
"position": 0,
"role": "",
"template": "relation cannot be null"
}
]
}messages · message.1
{
"limits": "",
"message_id": "message.1",
"path": "",
"position": 1,
"raw": {
"id": "message.1",
"primary_template": "on_error_stop cannot be null",
"severity_source": "ERROR",
"sources": [
"src.amcheck"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.amcheck"
],
"templates": [
{
"kind": "primary",
"literal": "on_error_stop cannot be null",
"position": 0,
"role": "",
"template": "on_error_stop cannot be null"
}
]
}messages · message.2
{
"limits": "",
"message_id": "message.2",
"path": "",
"position": 2,
"raw": {
"id": "message.2",
"primary_template": "check_toast cannot be null",
"severity_source": "ERROR",
"sources": [
"src.amcheck"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.amcheck"
],
"templates": [
{
"kind": "primary",
"literal": "check_toast cannot be null",
"position": 0,
"role": "",
"template": "check_toast cannot be null"
}
]
}messages · message.3
{
"limits": "",
"message_id": "message.3",
"path": "",
"position": 3,
"raw": {
"id": "message.3",
"primary_template": "skip cannot be null",
"severity_source": "ERROR",
"sources": [
"src.amcheck"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.amcheck"
],
"templates": [
{
"kind": "primary",
"literal": "skip cannot be null",
"position": 0,
"role": "",
"template": "skip cannot be null"
}
]
}messages · message.4
{
"limits": "",
"message_id": "message.4",
"path": "",
"position": 4,
"raw": {
"hint_template": "Valid skip options are \"all-visible\", \"all-frozen\", and \"none\".",
"id": "message.4",
"primary_template": "invalid skip option",
"severity_source": "ERROR",
"sources": [
"src.amcheck"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.amcheck"
],
"templates": [
{
"kind": "primary",
"literal": "invalid skip option",
"position": 0,
"role": "",
"template": "invalid skip option"
},
{
"kind": "hint",
"literal": "Valid skip options are \"all-visible\", \"all-frozen\", and \"none\".",
"position": 1,
"role": "",
"template": "Valid skip options are \"all-visible\", \"all-frozen\", and \"none\"."
}
]
}messages · message.5
{
"limits": "",
"message_id": "message.5",
"path": "",
"position": 5,
"raw": {
"id": "message.5",
"primary_template": "invalid value for floating point option \"%s\": %s",
"severity_source": "ERROR",
"sources": [
"src.postgres_fdw"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.postgres_fdw"
],
"templates": [
{
"kind": "primary",
"literal": "invalid value for floating point option \" \":",
"position": 0,
"role": "",
"template": "invalid value for floating point option \"%s\": %s"
}
]
}messages · message.6
{
"limits": "",
"message_id": "message.6",
"path": "",
"position": 6,
"raw": {
"id": "message.6",
"primary_template": "\"%s\" must be a floating point value greater than or equal to zero",
"severity_source": "ERROR",
"sources": [
"src.postgres_fdw"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.postgres_fdw"
],
"templates": [
{
"kind": "primary",
"literal": "\" \" must be a floating point value greater than or equal to zero",
"position": 0,
"role": "",
"template": "\"%s\" must be a floating point value greater than or equal to zero"
}
]
}messages · message.7
{
"limits": "",
"message_id": "message.7",
"path": "",
"position": 7,
"raw": {
"id": "message.7",
"primary_template": "invalid value for integer option \"%s\": %s",
"severity_source": "ERROR",
"sources": [
"src.postgres_fdw"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.postgres_fdw"
],
"templates": [
{
"kind": "primary",
"literal": "invalid value for integer option \" \":",
"position": 0,
"role": "",
"template": "invalid value for integer option \"%s\": %s"
}
]
}messages · message.8
{
"limits": "",
"message_id": "message.8",
"path": "",
"position": 8,
"raw": {
"id": "message.8",
"primary_template": "\"%s\" must be an integer value greater than zero",
"severity_source": "ERROR",
"sources": [
"src.postgres_fdw"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.postgres_fdw"
],
"templates": [
{
"kind": "primary",
"literal": "\" \" must be an integer value greater than zero",
"position": 0,
"role": "",
"template": "\"%s\" must be an integer value greater than zero"
}
]
}messages · message.9
{
"limits": "",
"message_id": "message.9",
"path": "",
"position": 9,
"raw": {
"id": "message.9",
"primary_template": "invalid regular expression option: \"%.*s\"",
"severity_source": "ERROR",
"sources": [
"src.regexp.options"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.regexp.options"
],
"templates": [
{
"kind": "primary",
"literal": "invalid regular expression option: \"%.*s\"",
"position": 0,
"role": "",
"template": "invalid regular expression option: \"%.*s\""
}
]
}messages · message.guc-bool
{
"limits": "",
"message_id": "message.guc-bool",
"path": "",
"position": 10,
"raw": {
"id": "message.guc-bool",
"primary_template": "parameter \"%s\" requires a Boolean value",
"severity_source": "ERROR",
"sources": [
"src.guc.parse"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.guc.parse"
],
"templates": [
{
"kind": "primary",
"literal": "parameter \" \" requires a Boolean value",
"position": 0,
"role": "",
"template": "parameter \"%s\" requires a Boolean value"
}
]
}messages · message.guc-invalid
{
"limits": "",
"message_id": "message.guc-invalid",
"path": "",
"position": 11,
"raw": {
"id": "message.guc-invalid",
"primary_template": "invalid value for parameter \"%s\": \"%s\"",
"severity_source": "ERROR",
"sources": [
"src.guc.parse",
"src.guc.hooks"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.guc.parse",
"src.guc.hooks"
],
"templates": [
{
"kind": "primary",
"literal": "invalid value for parameter \" \": \" \"",
"position": 0,
"role": "",
"template": "invalid value for parameter \"%s\": \"%s\""
}
]
}messages · message.guc-range-int
{
"limits": "",
"message_id": "message.guc-range-int",
"path": "",
"position": 12,
"raw": {
"id": "message.guc-range-int",
"primary_template": "%d%s%s is outside the valid range for parameter \"%s\" (%d%s%s .. %d%s%s)",
"severity_source": "ERROR",
"sources": [
"src.guc.parse"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.guc.parse"
],
"templates": [
{
"kind": "primary",
"literal": "is outside the valid range for parameter \" \" ( .. )",
"position": 0,
"role": "",
"template": "%d%s%s is outside the valid range for parameter \"%s\" (%d%s%s .. %d%s%s)"
}
]
}messages · message.guc-range-real
{
"limits": "",
"message_id": "message.guc-range-real",
"path": "",
"position": 13,
"raw": {
"id": "message.guc-range-real",
"primary_template": "%g%s%s is outside the valid range for parameter \"%s\" (%g%s%s .. %g%s%s)",
"severity_source": "ERROR",
"sources": [
"src.guc.parse"
],
"sqlstate": "22023"
},
"severity": "ERROR",
"sources": [
"src.guc.parse"
],
"templates": [
{
"kind": "primary",
"literal": "is outside the valid range for parameter \" \" ( .. )",
"position": 0,
"role": "",
"template": "%g%s%s is outside the valid range for parameter \"%s\" (%g%s%s .. %g%s%s)"
}
]
}runtimes · runtime.22023-work-mem-latest.latest · 18.6 (Homebrew) · passed
{
"cases": [
"invalid_work_mem_parameter"
],
"limits": "",
"position": 0,
"raw": {
"cases": [
"invalid_work_mem_parameter"
],
"id": "runtime.22023-work-mem-latest.latest",
"observed": {
"sqlstate": "22023",
"status_after_repair": "IDLE"
},
"raw": "verify/results/22023-work-mem-latest/latest/raw.jsonl",
"raw_sha256": "932cb783e8a553f44f6edffe9668d36c82f970e200a15770f73c8447f12f7b21",
"run_id": "22023-work-mem-latest",
"server_version": "18.6 (Homebrew)",
"server_version_num": 180006,
"snippet_registry": {
"path": "verify/cases/22023/snippets.json",
"sha256": "b353a8e7365013a0c5bd27aea71353f81ad125465c825df557bb8e122ddf49ac"
},
"status": "passed",
"summary": "verify/results/22023-work-mem-latest/latest/summary.json",
"summary_sha256": "1705bbe83c899a9ce9739bf627cbcc14a17d32c39bd5ca36d11102eabb92f56f",
"target": "latest"
},
"run_id": "22023-work-mem-latest",
"runtime_id": "runtime.22023-work-mem-latest.latest",
"server_version": "18.6 (Homebrew)",
"status": "passed",
"target": "latest"
}runtimes · runtime.22023-work-mem-pg10.pg10 · 10.21 (Debian 10.21-1.pgdg90+1) · passed
{
"cases": [
"invalid_work_mem_parameter"
],
"limits": "",
"position": 1,
"raw": {
"cases": [
"invalid_work_mem_parameter"
],
"id": "runtime.22023-work-mem-pg10.pg10",
"observed": {
"sqlstate": "22023",
"status_after_repair": "IDLE"
},
"raw": "verify/results/22023-work-mem-pg10/pg10/raw.jsonl",
"raw_sha256": "f583cfbb6b8204ba5354d14e0b4808120f648668c17f1c2c2923223bdb21c313",
"run_id": "22023-work-mem-pg10",
"server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
"server_version_num": 100021,
"snippet_registry": {
"path": "verify/cases/22023/snippets.json",
"sha256": "b353a8e7365013a0c5bd27aea71353f81ad125465c825df557bb8e122ddf49ac"
},
"status": "passed",
"summary": "verify/results/22023-work-mem-pg10/pg10/summary.json",
"summary_sha256": "9c817f503bad26ec87bd09cbb3b0bf701de02fb9c2dcb14b5472d8fcb1e85509",
"target": "pg10"
},
"run_id": "22023-work-mem-pg10",
"runtime_id": "runtime.22023-work-mem-pg10.pg10",
"server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
"status": "passed",
"target": "pg10"
}sources · src.errcodes.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/errcodes.txt",
"position": 0,
"sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
"source_id": "src.errcodes.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L185"
}sources · src.amcheck
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/amcheck/verify_heapam.c",
"position": 1,
"sha256": "54f1452790c2f2ecca059f38221a422a91ef5d35a436e48b1b12ba393a5881eb",
"source_id": "src.amcheck",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/amcheck/verify_heapam.c#L271"
}sources · src.postgres_fdw
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/postgres_fdw/option.c",
"position": 2,
"sha256": "880fd16c3e5cbc56733d1292ffdcc9b0f6cb1e17e72c90e9afa4e359239dc314",
"source_id": "src.postgres_fdw",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/postgres_fdw/option.c#L149"
}sources · src.regexp.options
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/regexp.c",
"position": 3,
"sha256": "8c54fe9e937ce03111b39da7bca89b22d6cb2de6b9ce5f7caf90c76bc7218e0e",
"source_id": "src.regexp.options",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/regexp.c#L443"
}sources · src.guc.parse
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/misc/guc.c",
"position": 4,
"sha256": "3021d40bb4e920a56fbc5e9452e32903a7364d7ce0aece65be70aa3c34c1274e",
"source_id": "src.guc.parse",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L3129"
}sources · src.guc.hooks
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/misc/guc.c",
"position": 5,
"sha256": "3021d40bb4e920a56fbc5e9452e32903a7364d7ce0aece65be70aa3c34c1274e",
"source_id": "src.guc.hooks",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L6804"
}sources · snippet-registry.22023
{
"commit": "",
"docs_url": "",
"kind": "local_artifact",
"location": "",
"path": "verify/cases/22023/snippets.json",
"position": 6,
"sha256": "b353a8e7365013a0c5bd27aea71353f81ad125465c825df557bb8e122ddf49ac",
"source_id": "snippet-registry.22023",
"tag": "",
"url": ""
}sources · src.guc.units
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/misc/guc.c",
"position": 7,
"sha256": "3021d40bb4e920a56fbc5e9452e32903a7364d7ce0aece65be70aa3c34c1274e",
"source_id": "src.guc.units",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L87"
}sources · src.guc.context
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/misc/guc.c",
"position": 8,
"sha256": "3021d40bb4e920a56fbc5e9452e32903a7364d7ce0aece65be70aa3c34c1274e",
"source_id": "src.guc.context",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L3342"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:88568757f333674973c9543e722b35a83acfb0e2013ba72285a041a497c14818
正文语言: zh-Hans · english-manuals:88568757f333674973c9543e722b35a83acfb0e2013ba72285a041a497c14818