1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

User and database-specific session defaults for run-time configuration

variables.  New commands ALTER DATABASE ... SET and ALTER USER ... SET.
This commit is contained in:
Peter Eisentraut
2002-03-01 22:45:19 +00:00
parent 851f766115
commit 1aac2c852a
29 changed files with 812 additions and 48 deletions

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.164 2002/03/01 06:01:18 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.165 2002/03/01 22:45:11 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2245,6 +2245,20 @@ _copyCreatedbStmt(CreatedbStmt *from)
return newnode;
}
static AlterDatabaseSetStmt *
_copyAlterDatabaseSetStmt(AlterDatabaseSetStmt *from)
{
AlterDatabaseSetStmt *newnode = makeNode(AlterDatabaseSetStmt);
if (from->dbname)
newnode->dbname = pstrdup(from->dbname);
if (from->variable)
newnode->variable = pstrdup(from->variable);
Node_Copy(from, newnode, value);
return newnode;
}
static DropdbStmt *
_copyDropdbStmt(DropdbStmt *from)
{
@@ -2427,6 +2441,20 @@ _copyAlterUserStmt(AlterUserStmt *from)
return newnode;
}
static AlterUserSetStmt *
_copyAlterUserSetStmt(AlterUserSetStmt *from)
{
AlterUserSetStmt *newnode = makeNode(AlterUserSetStmt);
if (from->user)
newnode->user = pstrdup(from->user);
if (from->variable)
newnode->user = pstrdup(from->variable);
Node_Copy(from, newnode, value);
return newnode;
}
static DropUserStmt *
_copyDropUserStmt(DropUserStmt *from)
{
@@ -2845,6 +2873,9 @@ copyObject(void *from)
case T_CreatedbStmt:
retval = _copyCreatedbStmt(from);
break;
case T_AlterDatabaseSetStmt:
retval = _copyAlterDatabaseSetStmt(from);
break;
case T_DropdbStmt:
retval = _copyDropdbStmt(from);
break;
@@ -2884,6 +2915,9 @@ copyObject(void *from)
case T_AlterUserStmt:
retval = _copyAlterUserStmt(from);
break;
case T_AlterUserSetStmt:
retval = _copyAlterUserSetStmt(from);
break;
case T_DropUserStmt:
retval = _copyDropUserStmt(from);
break;

View File

@@ -20,7 +20,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.111 2002/02/26 22:47:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.112 2002/03/01 22:45:12 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1112,6 +1112,19 @@ _equalCreatedbStmt(CreatedbStmt *a, CreatedbStmt *b)
return true;
}
static bool
_equalAlterDatabaseSetStmt(AlterDatabaseSetStmt *a, AlterDatabaseSetStmt *b)
{
if (!equalstr(a->dbname, b->dbname))
return false;
if (!equalstr(a->variable, b->variable))
return false;
if (!equal(a->value, b->value))
return false;
return true;
}
static bool
_equalDropdbStmt(DropdbStmt *a, DropdbStmt *b)
{
@@ -1289,6 +1302,19 @@ _equalAlterUserStmt(AlterUserStmt *a, AlterUserStmt *b)
return true;
}
static bool
_equalAlterUserSetStmt(AlterUserSetStmt *a, AlterUserSetStmt *b)
{
if (!equalstr(a->user, b->user))
return false;
if (!equalstr(a->variable, b->variable))
return false;
if (!equal(a->value, b->value))
return false;
return true;
}
static bool
_equalDropUserStmt(DropUserStmt *a, DropUserStmt *b)
{
@@ -1988,6 +2014,9 @@ equal(void *a, void *b)
case T_CreatedbStmt:
retval = _equalCreatedbStmt(a, b);
break;
case T_AlterDatabaseSetStmt:
retval = _equalAlterDatabaseSetStmt(a, b);
break;
case T_DropdbStmt:
retval = _equalDropdbStmt(a, b);
break;
@@ -2027,6 +2056,9 @@ equal(void *a, void *b)
case T_AlterUserStmt:
retval = _equalAlterUserStmt(a, b);
break;
case T_AlterUserSetStmt:
retval = _equalAlterUserSetStmt(a, b);
break;
case T_DropUserStmt:
retval = _equalDropUserStmt(a, b);
break;