55P02 — cant_change_runtime_param
当前上下文或阶段不允许修改该运行时参数。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Object Not In Prerequisite State
- condition name
- cant_change_runtime_param
- lang
- en
- sqlstate
- 55P02
版本定义 PG 18
55P02
速览 {#at-a-glance}
55P02 表示 PostgreSQL 因 GUC 上下文或服务器生命周期阶段不允许,而拒绝修改运行时参数。同一条件名覆盖只能重启、只能 SIGHUP、只能在 backend 启动时、内部参数以及 binary-upgrade guard 等路径。
含义 {#meaning}
set_config_with_handle() 使用 ereport(elevel, ...),所以客户端看到的 severity 取决于调用者:SQL SET 通常使用 ERROR,配置文件、数据库/角色设置等路径可能使用 LOG 或 WARNING。源码先检查 GUC context:内部参数不能由普通调用者修改;PGC_POSTMASTER 参数需要重启;PGC_SIGHUP 参数在 session 中修改会报 parameter "%s" cannot be changed now;backend 或 superuser-backend 参数在连接启动后修改会报 parameter "%s" cannot be set after connection start。重启提示也用于重载时试图改变 postmaster 参数的情形,ALTER SYSTEM 还会拒绝不能写入其配置文件的参数。
pg_upgrade_support.c 另有 binary-upgrade guard:IsBinaryUpgrade 为假时,升级辅助函数报此码。这是内部管理前置条件,不是普通 pg_settings.context 判断。
消息 {#messages}
- 内部参数或配置文件拒绝:primary 为
parameter "%s" cannot be changed;set_config_with_handle()的调用者提供 severity,而ALTER SYSTEMguard 使用 ERROR。 - 只能重启的参数:primary 为
parameter "%s" cannot be changed without restarting the server;severity 由调用者提供。 - 在 session 中修改 SIGHUP 参数:primary 为
parameter "%s" cannot be changed now;severity 由调用者提供。 - 连接启动后修改 backend 参数:primary 为
parameter "%s" cannot be set after connection start;severity 由调用者提供。 - binary-upgrade 模式外调用升级 helper:primary 为
function can only be called when server is in binary upgrade mode,ERROR。
诊断 {#diagnosis}
记录参数名、完整 primary message、设置来源(SET、启动选项、配置重载、数据库/角色设置、ALTER SYSTEM 或 binary-upgrade helper)及服务器阶段。检查 pg_settings.context、pending_restart、source 和 sourcefile:postmaster 指向重启,sighup 指向 reload,backend 指向新连接。值格式错误属于其他 SQLSTATE,不能只凭 55P02 判断。
用户发出的 SET 若以 ERROR 失败,会使显式事务进入错误状态;配置重载或后台路径可能只记录日志或发 WARNING,并不等于客户端事务被回滚,要以实际 severity 和连接状态为准。
处理 {#response}
按 pg_settings 指示的上下文修改:只能重启的值写入配置后重启,SIGHUP 值执行 reload,backend 值在新 session 中设置,内部或 binary-upgrade 参数交给所属机制。显式事务中的 SQL SET 失败后,先执行 ROLLBACK 或 ROLLBACK TO SAVEPOINT,再继续发送命令。autocommit 下先修正生命周期或设置来源,再重试;不要盲目重复同一被拒绝的操作。转换完成后核对实际生效值。
版本 {#versions}
锁定目录从 7.4 记录此条件;固定源码覆盖 PostgreSQL 18.6。已知存在于 是目录边界,不等于精确实现引入版本。
相关 {#related}
来源 {#sources}
src/backend/utils/misc/guc.c#L3407-3428
src/backend/utils/misc/guc.c#L3477-3512
src/backend/utils/misc/guc.c#L3550-3581
src/backend/utils/adt/pg_upgrade_support.c#L32-39
src/backend/utils/misc/guc.c#L4691-4694
结构化证据记录保存固定消息、调用者 severity 边界以及源码/运行范围。
比较版本
SQLSTATE 证据与已记录的运行版本
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read fixed definition.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "55P02 is cant_change_runtime_param in SQLSTATE Class 55."
}claims · resolved-paths
{
"claim_id": "resolved-paths",
"limits": "Source confirmation is not natural runtime.",
"method": "Read complete fixed source contexts.",
"position": 1,
"runtime": [],
"sources": [
"src.path.0",
"src.path.1",
"src.path.2",
"src.path.3",
"src.path.4"
],
"statement": "The fixed GUC context guards, caller severity selection, ALTER SYSTEM guard, and binary-upgrade guard support the mechanisms described."
}claims · severity-boundary
{
"claim_id": "severity-boundary",
"limits": "",
"method": "Read set_config_with_handle severity selection.",
"position": 2,
"runtime": [],
"sources": [
"src.path.0"
],
"statement": "The same report group uses caller-supplied elevel: SQL settings normally reach ERROR, while file/database/role sources can use LOG or WARNING."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue boundary.",
"position": 3,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 55P02 from 7.4; that boundary does not prove exact implementation introduction."
}messages · message.0
{
"limits": "",
"message_id": "message.0",
"path": "",
"position": 0,
"raw": {
"id": "message.0",
"primary_template": "parameter \"%s\" cannot be changed without restarting the server",
"severity_source": "caller-supplied elevel (normally ERROR for SQL SET; LOG/WARNING possible for configuration sources)",
"sources": [
"src.path.1",
"src.path.4"
],
"sqlstate": "55P02"
},
"severity": "caller-supplied elevel (normally ERROR for SQL SET; LOG/WARNING possible for configuration sources)",
"sources": [
"src.path.1",
"src.path.4"
],
"templates": [
{
"kind": "primary",
"literal": "parameter \" \" cannot be changed without restarting the server",
"position": 0,
"role": "",
"template": "parameter \"%s\" cannot be changed without restarting the server"
}
]
}messages · message.1
{
"limits": "",
"message_id": "message.1",
"path": "",
"position": 1,
"raw": {
"id": "message.1",
"primary_template": "parameter \"%s\" cannot be changed now",
"severity_source": "caller-supplied elevel",
"sources": [
"src.path.1"
],
"sqlstate": "55P02"
},
"severity": "caller-supplied elevel",
"sources": [
"src.path.1"
],
"templates": [
{
"kind": "primary",
"literal": "parameter \" \" cannot be changed now",
"position": 0,
"role": "",
"template": "parameter \"%s\" cannot be changed now"
}
]
}messages · message.2
{
"limits": "",
"message_id": "message.2",
"path": "",
"position": 2,
"raw": {
"id": "message.2",
"primary_template": "parameter \"%s\" cannot be set after connection start",
"severity_source": "caller-supplied elevel",
"sources": [
"src.path.2"
],
"sqlstate": "55P02"
},
"severity": "caller-supplied elevel",
"sources": [
"src.path.2"
],
"templates": [
{
"kind": "primary",
"literal": "parameter \" \" cannot be set after connection start",
"position": 0,
"role": "",
"template": "parameter \"%s\" cannot be set after connection start"
}
]
}messages · message.3
{
"limits": "",
"message_id": "message.3",
"path": "",
"position": 3,
"raw": {
"id": "message.3",
"primary_template": "parameter \"%s\" cannot be changed",
"severity_source": "ERROR",
"sources": [
"src.path.3",
"src.path.4"
],
"sqlstate": "55P02"
},
"severity": "ERROR",
"sources": [
"src.path.3",
"src.path.4"
],
"templates": [
{
"kind": "primary",
"literal": "parameter \" \" cannot be changed",
"position": 0,
"role": "",
"template": "parameter \"%s\" cannot be changed"
}
]
}messages · message.4
{
"limits": "",
"message_id": "message.4",
"path": "",
"position": 4,
"raw": {
"id": "message.4",
"primary_template": "function can only be called when server is in binary upgrade mode",
"severity_source": "ERROR",
"sources": [
"src.path.3"
],
"sqlstate": "55P02"
},
"severity": "ERROR",
"sources": [
"src.path.3"
],
"templates": [
{
"kind": "primary",
"literal": "function can only be called when server is in binary upgrade mode",
"position": 0,
"role": "",
"template": "function can only be called when server is in binary upgrade mode"
}
]
}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#L426"
}sources · src.path.0
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/misc/guc.c",
"position": 1,
"sha256": "3021d40bb4e920a56fbc5e9452e32903a7364d7ce0aece65be70aa3c34c1274e",
"source_id": "src.path.0",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L3407"
}sources · src.path.1
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/misc/guc.c",
"position": 2,
"sha256": "3021d40bb4e920a56fbc5e9452e32903a7364d7ce0aece65be70aa3c34c1274e",
"source_id": "src.path.1",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L3477"
}sources · src.path.2
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/misc/guc.c",
"position": 3,
"sha256": "3021d40bb4e920a56fbc5e9452e32903a7364d7ce0aece65be70aa3c34c1274e",
"source_id": "src.path.2",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L3550"
}sources · src.path.3
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/pg_upgrade_support.c",
"position": 4,
"sha256": "c9b9bfb233db85f0b8029f791d6cf39f6c479c3f7274dc2d7af0b79fbfbbd4ad",
"source_id": "src.path.3",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/pg_upgrade_support.c#L32"
}sources · src.path.4
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/misc/guc.c",
"position": 5,
"sha256": "3021d40bb4e920a56fbc5e9452e32903a7364d7ce0aece65be70aa3c34c1274e",
"source_id": "src.path.4",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L4691"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:56bd35593eed8aa40b6c084ee9477d59653df7b84d394c4c70dd1cf0fcd8e463
正文语言: zh-Hans · english-manuals:56bd35593eed8aa40b6c084ee9477d59653df7b84d394c4c70dd1cf0fcd8e463