{"Entry":{"collection":"guc","key":"db_user_namespace","name":"db_user_namespace","aliases":[],"metadata":{"baseline":true,"boot_human":"off","boot_val":"off","category":"Connections and Authentication / Authentication","category_zh":"","changed_in":["11"],"changes":[{"documentation_changed":true,"fields":{},"from":"8.0","status":"changed","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"8.3","status":"changed","to":"8.4"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{},"from":"9.4","status":"changed","to":"9.5"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":false,"fields":{"category":{"from":"Connections and Authentication / Security and Authentication","to":"Connections and Authentication / Authentication"}},"from":"10","status":"changed","to":"11"},{"documentation_changed":false,"fields":{},"from":"16","status":"removed","to":"17"}],"content_hash":"e7dbfed57acac6a6d810bb391776e6a90cc63da86a09104a6885a628ac2a36a5","context":"sighup","default_changed_in":[],"default_history":[{"from":"9.0","to":"16","value":"off"}],"editorial":{"advice":{"olap":"Do not build analytical tenancy on db_user_namespace. Use roles, schemas, databases, and row-level security according to the required boundary.","oltp":"Do not adopt or tune db_user_namespace: it was a legacy compatibility feature and is absent from PostgreSQL 17+. Migrate to ordinary cluster-wide roles with explicit authorization.","small":"Leave db_user_namespace off on old releases and remove dependencies before upgrading; it provides no useful small-node optimization."},"mechanism":["db_user_namespace enables per-database user names. This legacy feature represented users internally as user@database and was removed in PostgreSQL 17; it is not a modern tenant-isolation mechanism.","db_user_namespace is a SIGHUP-context setting: a configuration reload activates the new server value without a restart; subsequent operations that consult it use the refreshed value.","The final authentication path combines this setting with pg_hba.conf, role attributes, credential material, client capabilities, and sometimes operating-system identity services."],"pitfalls":["Editing db_user_namespace without reloading configuration and verifying the effective value and subsequent behavior.","Changing one authentication setting without testing pg_hba.conf ordering, existing secrets, mappings, and every client library.","Weakening identity policy to solve connection churn or CPU cost that should be addressed with pooling and capacity planning.","Changing db_user_namespace globally without a rollback plan and a client or operational compatibility test."],"references":[{"title":"PostgreSQL 16: db_user_namespace","url":"https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-DB-USER-NAMESPACE"}],"related":["password_encryption","scram_iterations","md5_password_warnings","authentication_timeout","oauth_validator_libraries","krb_server_keyfile"],"summary":"db_user_namespace is the PostgreSQL setting that controls whether PostgreSQL enables per-database user names."},"enumvals":[],"first_version":"7.4","group":"Connections and Authentication","group_slug":"connection","imported_at":"2026-09-27T17:57:31.022302+08:00","intro_commit":{},"key":"db_user_namespace","last_version":"16","max_val":"","min_val":"","name":"db_user_namespace","position":80,"present_in":["7.4","8.0","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"],"short_desc":"This parameter enables per-database user names.","short_desc_zh":"","source_rev":"english-manuals:f3fbf586bbf6587d6a993dfe0c4bb43e7bf26cede756672515ed65d0595939d1","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"db_user_namespace","SourceDatabase":"center","Version":"16","SourceTable":"guc","SourceKey":"db_user_namespace","SourceRevision":"english-manuals:f3fbf586bbf6587d6a993dfe0c4bb43e7bf26cede756672515ed65d0595939d1","Facts":{"boot_val":"off","category":"Connections and Authentication / Authentication","context":"sighup","description":"This parameter enables per-database user names. It is off by default. This parameter can only be set in the postgresql.conf file or on the server command line. If this is on, you should create users as username@dbname. When username is passed by a connecting client, @ and the database name are appended to the user name and that database-specific user name is looked up by the server. Note that when you create users with names containing @ within the SQL environment, you will need to quote the user name. With this parameter enabled, you can still create ordinary global users. Simply append @ when specifying the user name in the client, e.g., joe@. The @ will be stripped off before the user name is looked up by the server. db_user_namespace causes the client's and server's user name representation to differ. Authentication checks are always done with the server's user name so authentication methods must be configured for the server's user name, not the client's. Because md5 uses the user name as salt on both the client and server, md5 cannot be used with db_user_namespace. Note This feature is intended as a temporary measure until a complete solution is found. At that time, this option will be removed.","doc":{"anchor":"GUC-DB-USER-NAMESPACE","file":"runtime-config-connection.html","lang":"en","sha256":"6ab96e1555bedf3bf81e6cb64495da4469d6ec81d15a4188a32b84756d1630c7","slug":"16"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"16","min_val":null,"name":"db_user_namespace","short_desc":"Enables per-database user names.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-DB-USER-NAMESPACE","file":"runtime-config-connection.html","lang":"en","sha256":"6ab96e1555bedf3bf81e6cb64495da4469d6ec81d15a4188a32b84756d1630c7","slug":"16"}},"MeasuredEvidence":{"metadata_version":"16"}},"Text":{"Collection":"guc","Key":"db_user_namespace","SourceDatabase":"center","Version":"16","Locale":"en","Title":"db_user_namespace","Summary":"This parameter enables per-database user names. It is off by default. This parameter can only be set in the postgresql.conf file or on the server command line. If this is on, you should create users as username@dbname. When username is passed by a connecting client, @ and the database name are appended to the user name and that database-specific user name is looked up by the server. Note that when you create users with names containing @ within the SQL environment, you will need to quote the user name. With this parameter enabled, you can still create ordinary global users. Simply append @ when specifying the user name in the client, e.g., joe@. The @ will be stripped off before the user name is looked up by the server. db_user_namespace causes the client's and server's user name representation to differ. Authentication checks are always done with the server's user name so authentication methods must be configured for the server's user name, not the client's. Because md5 uses the user name as salt on both the client and server, md5 cannot be used with db_user_namespace. Note This feature is intended as a temporary measure until a complete solution is found. At that time, this option will be removed.","BodyHTML":"\u003cp\u003eThis parameter enables per-database user names. It is off by default. This parameter can only be set in the postgresql.conf file or on the server command line. If this is on, you should create users as username@dbname. When username is passed by a connecting client, @ and the database name are appended to the user name and that database-specific user name is looked up by the server. Note that when you create users with names containing @ within the SQL environment, you will need to quote the user name. With this parameter enabled, you can still create ordinary global users. Simply append @ when specifying the user name in the client, e.g., joe@. The @ will be stripped off before the user name is looked up by the server. db_user_namespace causes the client\u0026#39;s and server\u0026#39;s user name representation to differ. Authentication checks are always done with the server\u0026#39;s user name so authentication methods must be configured for the server\u0026#39;s user name, not the client\u0026#39;s. Because md5 uses the user name as salt on both the client and server, md5 cannot be used with db_user_namespace. Note This feature is intended as a temporary measure until a complete solution is found. At that time, this option will be removed.\u003c/p\u003e","SourceRevision":"english-manuals:f3fbf586bbf6587d6a993dfe0c4bb43e7bf26cede756672515ed65d0595939d1","ContentHash":"2dd2620aad62caed27137cf0d95a04ca8a0eca763c70d31915e4801142859b3e","Payload":{"description":"This parameter enables per-database user names. It is off by default. This parameter can only be set in the postgresql.conf file or on the server command line. If this is on, you should create users as username@dbname. When username is passed by a connecting client, @ and the database name are appended to the user name and that database-specific user name is looked up by the server. Note that when you create users with names containing @ within the SQL environment, you will need to quote the user name. With this parameter enabled, you can still create ordinary global users. Simply append @ when specifying the user name in the client, e.g., joe@. The @ will be stripped off before the user name is looked up by the server. db_user_namespace causes the client's and server's user name representation to differ. Authentication checks are always done with the server's user name so authentication methods must be configured for the server's user name, not the client's. Because md5 uses the user name as salt on both the client and server, md5 cannot be used with db_user_namespace. Note This feature is intended as a temporary measure until a complete solution is found. At that time, this option will be removed."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
