42939 — Reserved name
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.
English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- aliases
- Unknown
- class name
- Syntax Error or Access Rule Violation
- condition name
- reserved_name
- lang
- en
- sqlstate
- 42939
Definition PG 18
42939 — Reserved name
At a glance {#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.
Meaning {#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 {#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 {#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 {#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 {#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 {#related}
Sources {#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.
Compare versions
SQLSTATE evidence and recorded runtime versions
claims · identity.class-and-condition
{
"claim_id": "identity.class-and-condition",
"limits": "Identity does not enumerate all source branches or client failures.",
"method": "Read fixed REL_18_6 errcodes.txt and locked facts.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.42939.18.6"
],
"statement": "42939 is the reserved_name condition in Class 42."
}claims · mechanism.selected-source-path
{
"claim_id": "mechanism.selected-source-path",
"limits": "Representative confirmed core paths only; not exhaustive historical or extension coverage.",
"method": "Read complete resolved REL_18_6 report groups and message roles.",
"position": 1,
"runtime": [],
"sources": [
"src.call.42939.baa3c4599e167695f281cfe8",
"src.call.42939.aed179efd45a7ca409d59fd6",
"src.call.42939.419595a34cae2a69b2e21624",
"src.call.42939.role-grammar"
],
"statement": "Schema and tablespace paths reject reserved `pg_` names with object-specific DETAIL. CREATE ROLE reports the reserved `pg_` role path. RoleId grammar rejects `public`, `none`, SESSION_USER, CURRENT_USER, and CURRENT_ROLE in role-name positions, with a reserved-role-name primary for public/none and a `%s cannot be used as a role name here` primary for the current/session tokens."
}claims · versions.catalogue-boundary
{
"claim_id": "versions.catalogue-boundary",
"limits": "First observed release is a lower bound, not precise behavioral introduction.",
"method": "Read locked catalogue facts and definition snapshots.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.42939.18.6"
],
"statement": "From the locked 7.4 lower bound through 18.6 and 19beta3; multiple branches do not imply one introduction point."
}messages · message.variant-1
{
"limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed.",
"message_id": "message.variant-1",
"path": "",
"position": 0,
"raw": {
"detail_templates": [
"The prefix \"pg_\" is reserved for system schemas."
],
"hint_templates": [],
"id": "message.variant-1",
"limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed.",
"primary_template": "unacceptable schema name \"%s\"",
"roles": [
{
"role": "errmsg",
"template": "unacceptable schema name \"%s\""
},
{
"role": "errdetail",
"template": "The prefix \"pg_\" is reserved for system schemas."
}
],
"severity_source": "explicit ERROR",
"sources": [
"src.call.42939.baa3c4599e167695f281cfe8"
],
"sqlstate": "42939"
},
"severity": "explicit ERROR",
"sources": [
"src.call.42939.baa3c4599e167695f281cfe8"
],
"templates": [
{
"kind": "primary",
"literal": "unacceptable schema name \" \"",
"position": 0,
"role": "",
"template": "unacceptable schema name \"%s\""
},
{
"kind": "detail",
"literal": "The prefix \"pg_\" is reserved for system schemas.",
"position": 1,
"role": "",
"template": "The prefix \"pg_\" is reserved for system schemas."
},
{
"kind": "primary",
"literal": "The prefix \"pg_\" is reserved for system schemas.",
"position": 2,
"role": "errdetail",
"template": "The prefix \"pg_\" is reserved for system schemas."
}
]
}messages · message.variant-2
{
"limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed.",
"message_id": "message.variant-2",
"path": "",
"position": 1,
"raw": {
"detail_templates": [
"The prefix \"pg_\" is reserved for system tablespaces."
],
"hint_templates": [],
"id": "message.variant-2",
"limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed.",
"primary_template": "unacceptable tablespace name \"%s\"",
"roles": [
{
"role": "errmsg",
"template": "unacceptable tablespace name \"%s\""
},
{
"role": "errdetail",
"template": "The prefix \"pg_\" is reserved for system tablespaces."
}
],
"severity_source": "explicit ERROR",
"sources": [
"src.call.42939.aed179efd45a7ca409d59fd6"
],
"sqlstate": "42939"
},
"severity": "explicit ERROR",
"sources": [
"src.call.42939.aed179efd45a7ca409d59fd6"
],
"templates": [
{
"kind": "primary",
"literal": "unacceptable tablespace name \" \"",
"position": 0,
"role": "",
"template": "unacceptable tablespace name \"%s\""
},
{
"kind": "detail",
"literal": "The prefix \"pg_\" is reserved for system tablespaces.",
"position": 1,
"role": "",
"template": "The prefix \"pg_\" is reserved for system tablespaces."
},
{
"kind": "primary",
"literal": "The prefix \"pg_\" is reserved for system tablespaces.",
"position": 2,
"role": "errdetail",
"template": "The prefix \"pg_\" is reserved for system tablespaces."
}
]
}messages · message.variant-3
{
"limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed.",
"message_id": "message.variant-3",
"path": "",
"position": 2,
"raw": {
"detail_templates": [
"Role names starting with \"pg_\" are reserved."
],
"hint_templates": [],
"id": "message.variant-3",
"limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed.",
"primary_template": "role name \"%s\" is reserved",
"roles": [
{
"role": "errmsg",
"template": "role name \"%s\" is reserved"
},
{
"role": "errdetail",
"template": "Role names starting with \"pg_\" are reserved."
}
],
"severity_source": "explicit ERROR",
"sources": [
"src.call.42939.419595a34cae2a69b2e21624"
],
"sqlstate": "42939"
},
"severity": "explicit ERROR",
"sources": [
"src.call.42939.419595a34cae2a69b2e21624"
],
"templates": [
{
"kind": "primary",
"literal": "role name \" \" is reserved",
"position": 0,
"role": "",
"template": "role name \"%s\" is reserved"
},
{
"kind": "detail",
"literal": "Role names starting with \"pg_\" are reserved.",
"position": 1,
"role": "",
"template": "Role names starting with \"pg_\" are reserved."
},
{
"kind": "primary",
"literal": "Role names starting with \"pg_\" are reserved.",
"position": 2,
"role": "errdetail",
"template": "Role names starting with \"pg_\" are reserved."
}
]
}messages · message.variant-4
{
"limits": "The grammar supplies public or none as the dynamic role-name value; no concrete command is claimed.",
"message_id": "message.variant-4",
"path": "",
"position": 3,
"raw": {
"detail_templates": [],
"hint_templates": [],
"id": "message.variant-4",
"limits": "The grammar supplies public or none as the dynamic role-name value; no concrete command is claimed.",
"primary_template": "role name \"%s\" is reserved",
"roles": [
{
"role": "errmsg",
"template": "role name \"%s\" is reserved"
}
],
"severity_source": "explicit ERROR",
"sources": [
"src.call.42939.role-grammar"
],
"sqlstate": "42939"
},
"severity": "explicit ERROR",
"sources": [
"src.call.42939.role-grammar"
],
"templates": [
{
"kind": "primary",
"literal": "role name \" \" is reserved",
"position": 0,
"role": "",
"template": "role name \"%s\" is reserved"
}
]
}messages · message.variant-5
{
"limits": "The grammar supplies SESSION_USER, CURRENT_USER, or CURRENT_ROLE as the dynamic token; no concrete command is claimed.",
"message_id": "message.variant-5",
"path": "",
"position": 4,
"raw": {
"detail_templates": [],
"hint_templates": [],
"id": "message.variant-5",
"limits": "The grammar supplies SESSION_USER, CURRENT_USER, or CURRENT_ROLE as the dynamic token; no concrete command is claimed.",
"primary_template": "%s cannot be used as a role name here",
"roles": [
{
"role": "errmsg",
"template": "%s cannot be used as a role name here"
}
],
"severity_source": "explicit ERROR",
"sources": [
"src.call.42939.role-grammar"
],
"sqlstate": "42939"
},
"severity": "explicit ERROR",
"sources": [
"src.call.42939.role-grammar"
],
"templates": [
{
"kind": "primary",
"literal": "cannot be used as a role name here",
"position": 0,
"role": "",
"template": "%s cannot be used as a role name here"
}
]
}sources · src.errcodes.42939.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "line 349",
"path": "src/backend/utils/errcodes.txt",
"position": 0,
"sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
"source_id": "src.errcodes.42939.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L349"
}sources · src.call.42939.baa3c4599e167695f281cfe8
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "lines 107-110",
"path": "src/backend/commands/schemacmds.c",
"position": 1,
"sha256": "5fd5f43dce5f36f06ed390014c06f244564072227d25a22735f594d2170626b1",
"source_id": "src.call.42939.baa3c4599e167695f281cfe8",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/schemacmds.c#L107-L110"
}sources · src.call.42939.aed179efd45a7ca409d59fd6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "lines 281-285",
"path": "src/backend/commands/tablespace.c",
"position": 2,
"sha256": "f0369bece6339d18cd7d4a29b5fa3010447c3b8ece235c64b0d4fbf5f96a5317",
"source_id": "src.call.42939.aed179efd45a7ca409d59fd6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/tablespace.c#L281-L285"
}sources · src.call.42939.419595a34cae2a69b2e21624
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "lines 352-356",
"path": "src/backend/commands/user.c",
"position": 3,
"sha256": "aa8769a2577fff287301d6c82169262cca328515ae940d5a2be4b3e8c21617ed",
"source_id": "src.call.42939.419595a34cae2a69b2e21624",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/user.c#L352-L356"
}sources · src.call.42939.role-grammar
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "lines 17460-17542",
"path": "src/backend/parser/gram.y",
"position": 4,
"sha256": "7e548b673a1e03eb3a56c5eb9ad92d8e11095fac76e14cb258ca851f58274724",
"source_id": "src.call.42939.role-grammar",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/gram.y#L17460-L17542"
}sources · src.calls.REL_18_6.42939
{
"commit": "",
"docs_url": "",
"kind": "local_artifact",
"location": "",
"path": "raw/calls/REL_18_6.jsonl",
"position": 5,
"sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
"source_id": "src.calls.REL_18_6.42939",
"tag": "",
"url": ""
}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · english-manuals:0d70e673ee2234ce4c154ca262942f9c3fdbd1619a911f417ab54856c605bbc5
Text language: en · english-manuals:0d70e673ee2234ce4c154ca262942f9c3fdbd1619a911f417ab54856c605bbc5