diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-01-06 22:42:26 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-01-06 22:42:26 -0500 |
commit | 1489e2f26a4c0318938b3085f50976512f321d84 (patch) | |
tree | bc26ed1939cc2239a302e7c387efefe55550835d /src/include/commands | |
parent | 33aaa139e6302e81b4fbf2570be20188bb974c4f (diff) | |
download | postgresql-1489e2f26a4c0318938b3085f50976512f321d84.tar.gz postgresql-1489e2f26a4c0318938b3085f50976512f321d84.zip |
Improve behavior of concurrent ALTER TABLE, and do some refactoring.
ALTER TABLE (and ALTER VIEW, ALTER SEQUENCE, etc.) now use a
RangeVarGetRelid callback to check permissions before acquiring a table
lock. We also now use the same callback for all forms of ALTER TABLE,
rather than having separate, almost-identical callbacks for ALTER TABLE
.. SET SCHEMA and ALTER TABLE .. RENAME, and no callback at all for
everything else.
I went ahead and changed the code so that no form of ALTER TABLE works
on foreign tables; you must use ALTER FOREIGN TABLE instead. In 9.1,
it was possible to use ALTER TABLE .. SET SCHEMA or ALTER TABLE ..
RENAME on a foreign table, but not any other form of ALTER TABLE, which
did not seem terribly useful or consistent.
Patch by me; review by Noah Misch.
Diffstat (limited to 'src/include/commands')
-rw-r--r-- | src/include/commands/tablecmds.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index e73315e7507..03f397de639 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -24,7 +24,9 @@ extern Oid DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId); extern void RemoveRelations(DropStmt *drop); -extern void AlterTable(AlterTableStmt *stmt); +extern Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode); + +extern void AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt); extern LOCKMODE AlterTableGetLockLevel(List *cmds); @@ -32,8 +34,7 @@ extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, L extern void AlterTableInternal(Oid relid, List *cmds, bool recurse); -extern void AlterTableNamespace(RangeVar *relation, const char *newschema, - ObjectType stmttype, LOCKMODE lockmode); +extern void AlterTableNamespace(AlterObjectSchemaStmt *stmt); extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, |