This patch implement the TODO [ALTER DATABASE foo OWNER TO bar].

It was necessary to touch in grammar and create a new node to make home
to the new syntax. The command is also supported in E
CPG. Doc updates are attached too. Only superusers can change the owner
of the database. New owners don't need any aditional
privileges.

Euler Taveira de Oliveira
This commit is contained in:
Bruce Momjian
2004-05-26 13:57:04 +00:00
parent d0b4399d81
commit cfbfdc557d
11 changed files with 128 additions and 14 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.30 2003/11/29 22:40:59 pgsql Exp $
* $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.31 2004/05/26 13:56:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -20,6 +20,7 @@ extern void createdb(const CreatedbStmt *stmt);
extern void dropdb(const char *dbname);
extern void RenameDatabase(const char *oldname, const char *newname);
extern void AlterDatabaseSet(AlterDatabaseSetStmt *stmt);
extern void AlterDatabaseOwner(const char *dbname, const char *uname);
extern Oid get_database_oid(const char *dbname);
extern char *get_database_name(Oid dbid);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.155 2004/05/26 04:41:45 neilc Exp $
* $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.156 2004/05/26 13:57:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -266,6 +266,7 @@ typedef enum NodeTag
T_ExecuteStmt,
T_DeallocateStmt,
T_DeclareCursorStmt,
T_AlterDbOwnerStmt,
T_A_Expr = 800,
T_ColumnRef,

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.255 2004/05/05 04:48:47 tgl Exp $
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.256 2004/05/26 13:57:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -1523,6 +1523,13 @@ typedef struct CreatedbStmt
* Alter Database
* ----------------------
*/
typedef struct AlterDbOwnerStmt
{
NodeTag type;
char *dbname;
char *uname;
} AlterDbOwnerStmt;
typedef struct AlterDatabaseSetStmt
{
NodeTag type;