diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-25 21:55:59 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-25 21:55:59 +0000 |
commit | 0adfa2c39d567394f423c69bfaf467d0d00ee3df (patch) | |
tree | 215559f976b4e28454fcf7abaa8c96c748ec7fef /src/include | |
parent | 1621192b11369a7f0c47aaff1c8ec16bad29ab69 (diff) | |
download | postgresql-0adfa2c39d567394f423c69bfaf467d0d00ee3df.tar.gz postgresql-0adfa2c39d567394f423c69bfaf467d0d00ee3df.zip |
Support renaming of tablespaces, and changing the owners of
aggregates, conversions, functions, operators, operator classes,
schemas, types, and tablespaces. Fold the existing implementations
of alter domain owner and alter database owner in with these.
Christopher Kings-Lynne
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/commands/alter.h | 6 | ||||
-rw-r--r-- | src/include/commands/conversioncmds.h | 3 | ||||
-rw-r--r-- | src/include/commands/dbcommands.h | 4 | ||||
-rw-r--r-- | src/include/commands/defrem.h | 7 | ||||
-rw-r--r-- | src/include/commands/schemacmds.h | 3 | ||||
-rw-r--r-- | src/include/commands/tablespace.h | 5 | ||||
-rw-r--r-- | src/include/nodes/nodes.h | 4 | ||||
-rw-r--r-- | src/include/nodes/parsenodes.h | 29 |
8 files changed, 40 insertions, 21 deletions
diff --git a/src/include/commands/alter.h b/src/include/commands/alter.h index 58717ae03f5..2914fbbd8a6 100644 --- a/src/include/commands/alter.h +++ b/src/include/commands/alter.h @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * alter.h - * prototypes for alter.h + * prototypes for commands/alter.c * * * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/alter.h,v 1.3 2003/11/29 22:40:59 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/commands/alter.h,v 1.4 2004/06/25 21:55:58 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -18,4 +18,6 @@ extern void ExecRenameStmt(RenameStmt *stmt); +extern void ExecAlterOwnerStmt(AlterOwnerStmt *stmt); + #endif /* ALTER_H */ diff --git a/src/include/commands/conversioncmds.h b/src/include/commands/conversioncmds.h index 8ea65326c7c..a5146981177 100644 --- a/src/include/commands/conversioncmds.h +++ b/src/include/commands/conversioncmds.h @@ -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/conversioncmds.h,v 1.6 2003/11/29 22:40:59 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/commands/conversioncmds.h,v 1.7 2004/06/25 21:55:58 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,5 +20,6 @@ extern void CreateConversionCommand(CreateConversionStmt *parsetree); extern void DropConversionCommand(List *conversion_name, DropBehavior behavior); extern void RenameConversion(List *name, const char *newname); +extern void AlterConversionOwner(List *name, AclId newOwnerSysId); #endif /* CONVERSIONCMDS_H */ diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h index 30b73d4daf1..c481e8c9d91 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -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.31 2004/05/26 13:56:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.32 2004/06/25 21:55:58 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +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 void AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId); extern Oid get_database_oid(const char *dbname); extern char *get_database_name(Oid dbid); diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 8670a41a763..afe6cf0ac15 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -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/defrem.h,v 1.58 2004/06/18 06:14:08 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.59 2004/06/25 21:55:58 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -48,6 +48,7 @@ extern void RemoveFunctionById(Oid funcOid); extern void SetFunctionReturnType(Oid funcOid, Oid newRetType); extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType); extern void RenameFunction(List *name, List *argtypes, const char *newname); +extern void AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId); extern void CreateCast(CreateCastStmt *stmt); extern void DropCast(DropCastStmt *stmt); extern void DropCastById(Oid castOid); @@ -56,17 +57,21 @@ extern void DropCastById(Oid castOid); extern void DefineOperator(List *names, List *parameters); extern void RemoveOperator(RemoveOperStmt *stmt); extern void RemoveOperatorById(Oid operOid); +extern void AlterOperatorOwner(List *name, TypeName *typeName1, + TypeName *typename2, AclId newOwnerSysId); /* commands/aggregatecmds.c */ extern void DefineAggregate(List *names, List *parameters); extern void RemoveAggregate(RemoveAggrStmt *stmt); extern void RenameAggregate(List *name, TypeName *basetype, const char *newname); +extern void AlterAggregateOwner(List *name, TypeName *basetype, AclId newOwnerSysId); /* commands/opclasscmds.c */ extern void DefineOpClass(CreateOpClassStmt *stmt); extern void RemoveOpClass(RemoveOpClassStmt *stmt); extern void RemoveOpClassById(Oid opclassOid); extern void RenameOpClass(List *name, const char *access_method, const char *newname); +extern void AlterOpClassOwner(List *name, const char *access_method, AclId newOwnerSysId); /* support routines in commands/define.c */ diff --git a/src/include/commands/schemacmds.h b/src/include/commands/schemacmds.h index 6f772e6b3e8..96e03d80ad8 100644 --- a/src/include/commands/schemacmds.h +++ b/src/include/commands/schemacmds.h @@ -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/schemacmds.h,v 1.6 2003/11/29 22:40:59 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/commands/schemacmds.h,v 1.7 2004/06/25 21:55:58 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,5 +23,6 @@ extern void RemoveSchema(List *names, DropBehavior behavior); extern void RemoveSchemaById(Oid schemaOid); extern void RenameSchema(const char *oldname, const char *newname); +extern void AlterSchemaOwner(const char *name, AclId newOwnerSysId); #endif /* SCHEMACMDS_H */ diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h index 129413ac14b..17821493f45 100644 --- a/src/include/commands/tablespace.h +++ b/src/include/commands/tablespace.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.1 2004/06/18 06:14:08 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.2 2004/06/25 21:55:58 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -26,4 +26,7 @@ extern Oid get_tablespace_oid(const char *tablespacename); extern char *get_tablespace_name(Oid spc_oid); +extern void RenameTableSpace(const char *oldname, const char *newname); +extern void AlterTableSpaceOwner(const char *name, AclId newOwnerSysId); + #endif /* TABLESPACE_H */ diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 531b7e6c654..258bdc7b61e 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -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.158 2004/06/18 06:14:11 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.159 2004/06/25 21:55:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -270,7 +270,7 @@ typedef enum NodeTag T_DeclareCursorStmt, T_CreateTableSpaceStmt, T_DropTableSpaceStmt, - T_AlterDbOwnerStmt, + T_AlterOwnerStmt, T_A_Expr = 800, T_ColumnRef, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 4c24fe9e27b..22d18ef4f70 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -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.259 2004/06/18 06:14:11 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.260 2004/06/25 21:55:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -838,12 +838,10 @@ typedef struct AlterDomainStmt * O = alter column set not null * C = add constraint * X = drop constraint - * U = change owner *------------ */ List *typename; /* domain to work on */ - char *name; /* column or constraint name to act on, or - * new owner */ + char *name; /* column or constraint name to act on */ Node *def; /* definition of default or constraint */ DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ } AlterDomainStmt; @@ -1446,6 +1444,22 @@ typedef struct RenameStmt } RenameStmt; /* ---------------------- + * Alter Object Owner Statement + * ---------------------- + */ +typedef struct AlterOwnerStmt +{ + NodeTag type; + RangeVar *relation; /* in case it's a table */ + List *object; /* in case it's some other object */ + List *objarg; /* argument types, if applicable */ + char *addname; /* additional name if needed */ + char *newowner; /* the new owner */ + ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ +} AlterOwnerStmt; + + +/* ---------------------- * Create Rule Statement * ---------------------- */ @@ -1560,13 +1574,6 @@ typedef struct CreatedbStmt * Alter Database * ---------------------- */ -typedef struct AlterDbOwnerStmt -{ - NodeTag type; - char *dbname; - char *uname; -} AlterDbOwnerStmt; - typedef struct AlterDatabaseSetStmt { NodeTag type; |