1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

Make it possibly to specify GUC params per user and per database.

Create a new catalog pg_db_role_setting where they are now stored, and better
encapsulate the code that deals with settings into its realm.  The old
datconfig and rolconfig columns are removed.

psql has gained a \drds command to display the settings.

Backwards compatibility warning: while the backwards-compatible system views
still have the config columns, they no longer completely represent the
configuration for a user or database.

Catalog version bumped.
This commit is contained in:
Alvaro Herrera
2009-10-07 22:14:26 +00:00
parent 07cefdfb7a
commit 2eda8dfb52
32 changed files with 738 additions and 279 deletions

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.680 2009/10/05 19:24:38 tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.681 2009/10/07 22:14:21 alvherre Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -237,12 +237,13 @@ static TypeName *TableFuncTypeName(List *columns);
opt_grant_grant_option opt_grant_admin_option
opt_nowait opt_if_exists opt_with_data
%type <list> OptRoleList
%type <defelt> OptRoleElem
%type <list> OptRoleList AlterOptRoleList
%type <defelt> CreateOptRoleElem AlterOptRoleElem
%type <str> opt_type
%type <str> foreign_server_version opt_foreign_server_version
%type <str> auth_ident
%type <str> opt_in_database
%type <str> OptSchemaName
%type <list> OptSchemaEltList
@@ -762,11 +763,16 @@ opt_with: WITH {}
* is "WITH ADMIN name".
*/
OptRoleList:
OptRoleList OptRoleElem { $$ = lappend($1, $2); }
OptRoleList CreateOptRoleElem { $$ = lappend($1, $2); }
| /* EMPTY */ { $$ = NIL; }
;
OptRoleElem:
AlterOptRoleList:
AlterOptRoleList AlterOptRoleElem { $$ = lappend($1, $2); }
| /* EMPTY */ { $$ = NIL; }
;
AlterOptRoleElem:
PASSWORD Sconst
{
$$ = makeDefElem("password",
@@ -848,7 +854,11 @@ OptRoleElem:
{
$$ = makeDefElem("rolemembers", (Node *)$2);
}
/* The following are not supported by ALTER ROLE/USER/GROUP */
;
CreateOptRoleElem:
AlterOptRoleElem { $$ = $1; }
/* The following are not supported by ALTER ROLE/USER/GROUP */
| SYSID Iconst
{
$$ = makeDefElem("sysid", (Node *)makeInteger($2));
@@ -897,7 +907,7 @@ CreateUserStmt:
*****************************************************************************/
AlterRoleStmt:
ALTER ROLE RoleId opt_with OptRoleList
ALTER ROLE RoleId opt_with AlterOptRoleList
{
AlterRoleStmt *n = makeNode(AlterRoleStmt);
n->role = $3;
@@ -907,12 +917,18 @@ AlterRoleStmt:
}
;
opt_in_database:
/* EMPTY */ { $$ = NULL; }
| IN_P DATABASE database_name { $$ = $3; }
;
AlterRoleSetStmt:
ALTER ROLE RoleId SetResetClause
ALTER ROLE RoleId opt_in_database SetResetClause
{
AlterRoleSetStmt *n = makeNode(AlterRoleSetStmt);
n->role = $3;
n->setstmt = $4;
n->database = $4;
n->setstmt = $5;
$$ = (Node *)n;
}
;
@@ -925,7 +941,7 @@ AlterRoleSetStmt:
*****************************************************************************/
AlterUserStmt:
ALTER USER RoleId opt_with OptRoleList
ALTER USER RoleId opt_with AlterOptRoleList
{
AlterRoleStmt *n = makeNode(AlterRoleStmt);
n->role = $3;
@@ -941,6 +957,7 @@ AlterUserSetStmt:
{
AlterRoleSetStmt *n = makeNode(AlterRoleSetStmt);
n->role = $3;
n->database = NULL;
n->setstmt = $4;
$$ = (Node *)n;
}