42939 — Reserved name
42939 — Reserved name
At a glance
42939 (reserved_name) rejects a name under an object-specific PostgreSQL rule. The selected 18.6 paths cover schemas, tablespaces, role creation, and role-specification grammar; the object named in the message determines which rule fired.
| Field | Value |
|---|---|
| SQLSTATE | 42939 |
| Condition | reserved_name |
| Status | active |
| Known present by | 7.4 |
| Locked snapshots | 9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3 |
| Macros | ERRCODE_RESERVED_NAME |
| Aliases | — |
Meaning
Schema creation rejects a reserved pg_ prefix with unacceptable schema name "%s" and a system-schema DETAIL. Tablespace creation has the parallel system-tablespace message. CREATE ROLE rejects the pg_ prefix with role name "%s" is reserved. Separately, the grammar’s RoleId conversion rejects public, none, SESSION_USER, CURRENT_USER, and CURRENT_ROLE in role-name positions: public and none use the reserved-role-name primary, while the three current/session tokens use %s cannot be used as a role name here. These grammar rules do not make those words reserved in every identifier position.
Diagnosis
Start with the exact primary and DETAIL. unacceptable schema name points to the schema prefix guard; unacceptable tablespace name points to the tablespace guard; role name ... is reserved can be a pg_ role or the grammar’s public/none path; and %s cannot be used as a role name here identifies a role-specification token. For a grammar failure, inspect the command’s role position rather than searching pg_namespace or pg_authid. Do not infer a role failure from a tablespace message.
Response
Choose an allowed object name after checking migration and ownership. For a role-specification error, replace the role token with an actual allowed role identifier in that grammar position; quoting or changing search_path is not a substitute for fixing the command. Do not rename or drop system objects to force success; update dependent grants and configuration deliberately. If an object-level ERROR occurred inside an explicit transaction, use a savepoint rollback or transaction rollback before retrying.
Messages
The selected paths are explicit ERRORs. Their exact primary/detail roles are:
- schema:
unacceptable schema name "%s"withThe prefix "pg_" is reserved for system schemas. - tablespace:
unacceptable tablespace name "%s"withThe prefix "pg_" is reserved for system tablespaces. - role prefix:
role name "%s" is reservedwithRole names starting with "pg_" are reserved. - role grammar:
role name "%s" is reservedforpublic/none, or%s cannot be used as a role name hereforSESSION_USER,CURRENT_USER, andCURRENT_ROLE.
Versions
From the locked 7.4 lower bound through 18.6 and 19beta3; that catalogue range is a condition bound, not one introduction point for every object-specific rule. The selected mechanisms are source-only and runtime was not run.
Related
Sources
-
src.errcodes.42939.18.6—src/backend/utils/errcodes.txtline 349, fixed at724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-2566e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba(source). -
src.call.42939.baa3c4599e167695f281cfe8—src/backend/commands/schemacmds.clines 107-110, fixed at724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-2565fd5f43dce5f36f06ed390014c06f244564072227d25a22735f594d2170626b1(source). -
src.call.42939.aed179efd45a7ca409d59fd6—src/backend/commands/tablespace.clines 281-285, fixed at724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-256f0369bece6339d18cd7d4a29b5fa3010447c3b8ece235c64b0d4fbf5f96a5317(source). -
src.call.42939.419595a34cae2a69b2e21624—src/backend/commands/user.clines 352-356, fixed at724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-256aa8769a2577fff287301d6c82169262cca328515ae940d5a2be4b3e8c21617ed(source). -
src.call.42939.role-grammar—src/backend/parser/gram.ylines 17460-17542, fixed at724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-2567e548b673a1e03eb3a56c5eb9ad92d8e11095fac76e14cb258ca851f58274724(source). -
src.calls.REL_18_6.42939— resolved core call groups; SHA-2569ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf. -
authored evidence— source claims, message roles, and runtime boundary.