2003-06-27 16:45:32 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* alter.c
|
|
|
|
* Drivers for generic alter commands
|
|
|
|
*
|
2010-01-02 17:58:17 +01:00
|
|
|
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
2003-06-27 16:45:32 +02:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/backend/commands/alter.c
|
2003-06-27 16:45:32 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
|
|
|
2010-11-26 23:27:23 +01:00
|
|
|
#include "catalog/dependency.h"
|
|
|
|
#include "catalog/indexing.h"
|
2003-06-27 16:45:32 +02:00
|
|
|
#include "catalog/namespace.h"
|
2009-12-11 04:34:57 +01:00
|
|
|
#include "catalog/pg_largeobject.h"
|
2010-11-26 23:27:23 +01:00
|
|
|
#include "catalog/pg_namespace.h"
|
2003-06-27 16:45:32 +02:00
|
|
|
#include "commands/alter.h"
|
|
|
|
#include "commands/conversioncmds.h"
|
|
|
|
#include "commands/dbcommands.h"
|
|
|
|
#include "commands/defrem.h"
|
|
|
|
#include "commands/proclang.h"
|
|
|
|
#include "commands/schemacmds.h"
|
|
|
|
#include "commands/tablecmds.h"
|
2004-06-25 23:55:59 +02:00
|
|
|
#include "commands/tablespace.h"
|
2003-06-27 16:45:32 +02:00
|
|
|
#include "commands/trigger.h"
|
2004-06-25 23:55:59 +02:00
|
|
|
#include "commands/typecmds.h"
|
2003-06-27 16:45:32 +02:00
|
|
|
#include "commands/user.h"
|
|
|
|
#include "miscadmin.h"
|
|
|
|
#include "parser/parse_clause.h"
|
2003-07-22 21:00:12 +02:00
|
|
|
#include "tcop/utility.h"
|
2003-06-27 16:45:32 +02:00
|
|
|
#include "utils/acl.h"
|
2010-06-13 19:43:13 +02:00
|
|
|
#include "utils/builtins.h"
|
2003-06-27 16:45:32 +02:00
|
|
|
#include "utils/lsyscache.h"
|
2010-11-26 23:27:23 +01:00
|
|
|
#include "utils/syscache.h"
|
2003-06-27 16:45:32 +02:00
|
|
|
|
|
|
|
|
2004-06-25 23:55:59 +02:00
|
|
|
/*
|
2004-08-29 07:07:03 +02:00
|
|
|
* Executes an ALTER OBJECT / RENAME TO statement. Based on the object
|
2004-06-25 23:55:59 +02:00
|
|
|
* type, the function appropriate to that type is executed.
|
|
|
|
*/
|
2003-06-27 16:45:32 +02:00
|
|
|
void
|
|
|
|
ExecRenameStmt(RenameStmt *stmt)
|
|
|
|
{
|
|
|
|
switch (stmt->renameType)
|
|
|
|
{
|
|
|
|
case OBJECT_AGGREGATE:
|
2006-04-15 19:45:46 +02:00
|
|
|
RenameAggregate(stmt->object, stmt->objarg, stmt->newname);
|
2003-06-27 16:45:32 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_CONVERSION:
|
|
|
|
RenameConversion(stmt->object, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_DATABASE:
|
|
|
|
RenameDatabase(stmt->subname, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_FUNCTION:
|
|
|
|
RenameFunction(stmt->object, stmt->objarg, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_LANGUAGE:
|
|
|
|
RenameLanguage(stmt->subname, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_OPCLASS:
|
|
|
|
RenameOpClass(stmt->object, stmt->subname, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
2007-01-23 06:07:18 +01:00
|
|
|
case OBJECT_OPFAMILY:
|
|
|
|
RenameOpFamily(stmt->object, stmt->subname, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
2005-06-28 07:09:14 +02:00
|
|
|
case OBJECT_ROLE:
|
|
|
|
RenameRole(stmt->subname, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
2003-06-27 16:45:32 +02:00
|
|
|
case OBJECT_SCHEMA:
|
|
|
|
RenameSchema(stmt->subname, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
2004-06-25 23:55:59 +02:00
|
|
|
case OBJECT_TABLESPACE:
|
|
|
|
RenameTableSpace(stmt->subname, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
2003-06-27 16:45:32 +02:00
|
|
|
case OBJECT_TABLE:
|
2007-07-03 03:30:37 +02:00
|
|
|
case OBJECT_SEQUENCE:
|
|
|
|
case OBJECT_VIEW:
|
2004-08-22 02:08:28 +02:00
|
|
|
case OBJECT_INDEX:
|
2003-06-27 16:45:32 +02:00
|
|
|
case OBJECT_COLUMN:
|
2010-09-26 13:41:03 +02:00
|
|
|
case OBJECT_ATTRIBUTE:
|
2003-06-27 16:45:32 +02:00
|
|
|
case OBJECT_TRIGGER:
|
2003-08-04 02:43:34 +02:00
|
|
|
{
|
|
|
|
Oid relid;
|
2003-06-27 16:45:32 +02:00
|
|
|
|
2003-08-04 02:43:34 +02:00
|
|
|
CheckRelationOwnership(stmt->relation, true);
|
2003-06-27 16:45:32 +02:00
|
|
|
|
2003-08-04 02:43:34 +02:00
|
|
|
relid = RangeVarGetRelid(stmt->relation, false);
|
2003-06-27 16:45:32 +02:00
|
|
|
|
2003-08-04 02:43:34 +02:00
|
|
|
switch (stmt->renameType)
|
2003-06-27 16:45:32 +02:00
|
|
|
{
|
2003-08-04 02:43:34 +02:00
|
|
|
case OBJECT_TABLE:
|
2007-07-03 03:30:37 +02:00
|
|
|
case OBJECT_SEQUENCE:
|
|
|
|
case OBJECT_VIEW:
|
2004-08-22 02:08:28 +02:00
|
|
|
case OBJECT_INDEX:
|
2003-08-04 02:43:34 +02:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* RENAME TABLE requires that we (still) hold
|
2005-10-15 04:49:52 +02:00
|
|
|
* CREATE rights on the containing namespace, as
|
|
|
|
* well as ownership of the table.
|
2003-08-04 02:43:34 +02:00
|
|
|
*/
|
|
|
|
Oid namespaceId = get_rel_namespace(relid);
|
|
|
|
AclResult aclresult;
|
|
|
|
|
|
|
|
aclresult = pg_namespace_aclcheck(namespaceId,
|
2006-02-12 20:11:01 +01:00
|
|
|
GetUserId(),
|
|
|
|
ACL_CREATE);
|
2003-08-04 02:43:34 +02:00
|
|
|
if (aclresult != ACLCHECK_OK)
|
|
|
|
aclcheck_error(aclresult, ACL_KIND_NAMESPACE,
|
2005-10-15 04:49:52 +02:00
|
|
|
get_namespace_name(namespaceId));
|
2003-08-04 02:43:34 +02:00
|
|
|
|
2008-03-19 19:38:30 +01:00
|
|
|
RenameRelation(relid, stmt->newname, stmt->renameType);
|
2003-08-04 02:43:34 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OBJECT_COLUMN:
|
2010-09-26 13:41:03 +02:00
|
|
|
case OBJECT_ATTRIBUTE:
|
2010-11-23 21:50:17 +01:00
|
|
|
renameatt(relid, stmt);
|
2003-08-04 02:43:34 +02:00
|
|
|
break;
|
|
|
|
case OBJECT_TRIGGER:
|
|
|
|
renametrig(relid,
|
|
|
|
stmt->subname, /* old att name */
|
|
|
|
stmt->newname); /* new att name */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* can't happen */ ;
|
|
|
|
}
|
|
|
|
break;
|
2003-06-27 16:45:32 +02:00
|
|
|
}
|
|
|
|
|
2007-08-21 03:11:32 +02:00
|
|
|
case OBJECT_TSPARSER:
|
|
|
|
RenameTSParser(stmt->object, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TSDICTIONARY:
|
|
|
|
RenameTSDictionary(stmt->object, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TSTEMPLATE:
|
|
|
|
RenameTSTemplate(stmt->object, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TSCONFIGURATION:
|
|
|
|
RenameTSConfiguration(stmt->object, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
2008-03-19 19:38:30 +01:00
|
|
|
case OBJECT_TYPE:
|
|
|
|
RenameType(stmt->object, stmt->newname);
|
|
|
|
break;
|
|
|
|
|
2003-06-27 16:45:32 +02:00
|
|
|
default:
|
2003-07-20 23:56:35 +02:00
|
|
|
elog(ERROR, "unrecognized rename stmt type: %d",
|
|
|
|
(int) stmt->renameType);
|
2003-06-27 16:45:32 +02:00
|
|
|
}
|
|
|
|
}
|
2004-06-25 23:55:59 +02:00
|
|
|
|
2005-08-01 06:03:59 +02:00
|
|
|
/*
|
|
|
|
* Executes an ALTER OBJECT / SET SCHEMA statement. Based on the object
|
|
|
|
* type, the function appropriate to that type is executed.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
|
|
|
|
{
|
|
|
|
switch (stmt->objectType)
|
|
|
|
{
|
|
|
|
case OBJECT_AGGREGATE:
|
2006-04-15 19:45:46 +02:00
|
|
|
AlterFunctionNamespace(stmt->object, stmt->objarg, true,
|
|
|
|
stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
2010-11-26 23:27:23 +01:00
|
|
|
case OBJECT_CONVERSION:
|
|
|
|
AlterConversionNamespace(stmt->object, stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
2005-08-01 06:03:59 +02:00
|
|
|
case OBJECT_FUNCTION:
|
2006-04-15 19:45:46 +02:00
|
|
|
AlterFunctionNamespace(stmt->object, stmt->objarg, false,
|
2005-08-01 06:03:59 +02:00
|
|
|
stmt->newschema);
|
|
|
|
break;
|
2005-10-15 04:49:52 +02:00
|
|
|
|
2010-11-26 23:27:23 +01:00
|
|
|
case OBJECT_OPERATOR:
|
|
|
|
AlterOperatorNamespace(stmt->object, stmt->objarg, stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_OPCLASS:
|
|
|
|
AlterOpClassNamespace(stmt->object, stmt->objarg, stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_OPFAMILY:
|
|
|
|
AlterOpFamilyNamespace(stmt->object, stmt->objarg, stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
2005-08-01 06:03:59 +02:00
|
|
|
case OBJECT_SEQUENCE:
|
|
|
|
case OBJECT_TABLE:
|
2008-06-15 03:25:54 +02:00
|
|
|
case OBJECT_VIEW:
|
2005-08-01 06:03:59 +02:00
|
|
|
CheckRelationOwnership(stmt->relation, true);
|
2008-06-15 03:25:54 +02:00
|
|
|
AlterTableNamespace(stmt->relation, stmt->newschema,
|
2010-07-28 07:22:24 +02:00
|
|
|
stmt->objectType, AccessExclusiveLock);
|
2005-08-01 06:03:59 +02:00
|
|
|
break;
|
2005-10-15 04:49:52 +02:00
|
|
|
|
2010-11-26 23:27:23 +01:00
|
|
|
case OBJECT_TSPARSER:
|
|
|
|
AlterTSParserNamespace(stmt->object, stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TSDICTIONARY:
|
|
|
|
AlterTSDictionaryNamespace(stmt->object, stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TSTEMPLATE:
|
|
|
|
AlterTSTemplateNamespace(stmt->object, stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TSCONFIGURATION:
|
|
|
|
AlterTSConfigurationNamespace(stmt->object, stmt->newschema);
|
|
|
|
break;
|
|
|
|
|
2005-08-01 06:03:59 +02:00
|
|
|
case OBJECT_TYPE:
|
|
|
|
case OBJECT_DOMAIN:
|
|
|
|
AlterTypeNamespace(stmt->object, stmt->newschema);
|
|
|
|
break;
|
2005-10-15 04:49:52 +02:00
|
|
|
|
2005-08-01 06:03:59 +02:00
|
|
|
default:
|
|
|
|
elog(ERROR, "unrecognized AlterObjectSchemaStmt type: %d",
|
|
|
|
(int) stmt->objectType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-26 23:27:23 +01:00
|
|
|
/*
|
|
|
|
* Generic function to change the namespace of a given object, for simple
|
|
|
|
* cases (won't work for tables or functions, objects which have more than 2
|
|
|
|
* key-attributes to use when searching for their syscache entries --- we
|
|
|
|
* don't want nor need to get this generic here).
|
|
|
|
*
|
|
|
|
* The AlterFooNamespace() calls just above will call a function whose job
|
|
|
|
* is to lookup the arguments for the generic function here.
|
|
|
|
*
|
|
|
|
* Relation must already by open, it's the responsibility of the caller to
|
|
|
|
* close it.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
AlterObjectNamespace(Relation rel, int cacheId,
|
|
|
|
Oid classId, Oid objid, Oid nspOid,
|
|
|
|
int Anum_name, int Anum_namespace, int Anum_owner,
|
|
|
|
AclObjectKind acl_kind,
|
|
|
|
bool superuser_only)
|
|
|
|
{
|
|
|
|
Oid oldNspOid;
|
|
|
|
Datum name, namespace;
|
|
|
|
bool isnull;
|
|
|
|
HeapTuple tup, newtup = NULL;
|
|
|
|
Datum *values;
|
|
|
|
bool *nulls;
|
|
|
|
bool *replaces;
|
|
|
|
|
|
|
|
tup = SearchSysCacheCopy1(cacheId, ObjectIdGetDatum(objid));
|
|
|
|
if (!HeapTupleIsValid(tup)) /* should not happen */
|
|
|
|
elog(ERROR, "cache lookup failed for object %u: %s",
|
|
|
|
objid, getObjectDescriptionOids(classId, objid));
|
|
|
|
|
|
|
|
name = heap_getattr(tup, Anum_name, rel->rd_att, &isnull);
|
|
|
|
namespace = heap_getattr(tup, Anum_namespace, rel->rd_att, &isnull);
|
|
|
|
oldNspOid = DatumGetObjectId(namespace);
|
|
|
|
|
|
|
|
/* Check basic namespace related issues */
|
|
|
|
CheckSetNamespace(oldNspOid, nspOid, classId, objid);
|
|
|
|
|
|
|
|
/* check for duplicate name (more friendly than unique-index failure) */
|
|
|
|
if (SearchSysCacheExists2(cacheId, name, ObjectIdGetDatum(nspOid)))
|
|
|
|
ereport(ERROR,
|
|
|
|
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
|
|
|
errmsg("%s already exists in schema \"%s\"",
|
|
|
|
getObjectDescriptionOids(classId, objid),
|
|
|
|
get_namespace_name(nspOid))));
|
|
|
|
|
|
|
|
/* Superusers can always do it */
|
|
|
|
if (!superuser())
|
|
|
|
{
|
|
|
|
Datum owner;
|
|
|
|
Oid ownerId;
|
|
|
|
AclResult aclresult;
|
|
|
|
|
|
|
|
if (superuser_only)
|
|
|
|
ereport(ERROR,
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
|
|
|
(errmsg("must be superuser to SET SCHEMA of %s",
|
|
|
|
getObjectDescriptionOids(classId, objid)))));
|
|
|
|
|
|
|
|
/* Otherwise, must be owner of the existing object */
|
|
|
|
owner = heap_getattr(tup, Anum_owner, rel->rd_att, &isnull);
|
|
|
|
ownerId = DatumGetObjectId(owner);
|
|
|
|
|
|
|
|
if (!has_privs_of_role(GetUserId(), ownerId))
|
|
|
|
aclcheck_error(ACLCHECK_NOT_OWNER, acl_kind,
|
|
|
|
NameStr(*(DatumGetName(name))));
|
|
|
|
|
|
|
|
/* owner must have CREATE privilege on namespace */
|
|
|
|
aclresult = pg_namespace_aclcheck(oldNspOid, GetUserId(), ACL_CREATE);
|
|
|
|
if (aclresult != ACLCHECK_OK)
|
|
|
|
aclcheck_error(aclresult, ACL_KIND_NAMESPACE,
|
|
|
|
get_namespace_name(oldNspOid));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Prepare to update tuple */
|
|
|
|
values = palloc0(rel->rd_att->natts * sizeof(Datum));
|
|
|
|
nulls = palloc0(rel->rd_att->natts * sizeof(bool));
|
|
|
|
replaces = palloc0(rel->rd_att->natts * sizeof(bool));
|
|
|
|
values[Anum_namespace - 1] = nspOid;
|
|
|
|
replaces[Anum_namespace - 1] = true;
|
|
|
|
newtup = heap_modify_tuple(tup, rel->rd_att, values, nulls, replaces);
|
|
|
|
|
|
|
|
/* Perform actual update */
|
|
|
|
simple_heap_update(rel, &tup->t_self, newtup);
|
|
|
|
CatalogUpdateIndexes(rel, newtup);
|
|
|
|
|
|
|
|
/* Release memory */
|
|
|
|
pfree(values);
|
|
|
|
pfree(nulls);
|
|
|
|
pfree(replaces);
|
|
|
|
|
|
|
|
/* update dependencies to point to the new schema */
|
|
|
|
changeDependencyFor(classId, objid,
|
|
|
|
NamespaceRelationId, oldNspOid, nspOid);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-25 23:55:59 +02:00
|
|
|
/*
|
|
|
|
* Executes an ALTER OBJECT / OWNER TO statement. Based on the object
|
|
|
|
* type, the function appropriate to that type is executed.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
|
|
|
|
{
|
2010-08-05 16:45:09 +02:00
|
|
|
Oid newowner = get_role_oid(stmt->newowner, false);
|
2004-06-25 23:55:59 +02:00
|
|
|
|
|
|
|
switch (stmt->objectType)
|
|
|
|
{
|
|
|
|
case OBJECT_AGGREGATE:
|
2006-04-15 19:45:46 +02:00
|
|
|
AlterAggregateOwner(stmt->object, stmt->objarg, newowner);
|
2004-06-25 23:55:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_CONVERSION:
|
|
|
|
AlterConversionOwner(stmt->object, newowner);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_DATABASE:
|
2008-02-07 22:07:55 +01:00
|
|
|
AlterDatabaseOwner(strVal(linitial(stmt->object)), newowner);
|
2004-06-25 23:55:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_FUNCTION:
|
|
|
|
AlterFunctionOwner(stmt->object, stmt->objarg, newowner);
|
|
|
|
break;
|
|
|
|
|
2007-03-26 18:58:41 +02:00
|
|
|
case OBJECT_LANGUAGE:
|
2008-02-07 22:07:55 +01:00
|
|
|
AlterLanguageOwner(strVal(linitial(stmt->object)), newowner);
|
2007-03-26 18:58:41 +02:00
|
|
|
break;
|
|
|
|
|
2009-12-11 04:34:57 +01:00
|
|
|
case OBJECT_LARGEOBJECT:
|
2010-06-13 19:43:13 +02:00
|
|
|
LargeObjectAlterOwner(oidparse(linitial(stmt->object)), newowner);
|
2009-12-11 04:34:57 +01:00
|
|
|
break;
|
|
|
|
|
2004-06-25 23:55:59 +02:00
|
|
|
case OBJECT_OPERATOR:
|
2006-04-15 19:45:46 +02:00
|
|
|
Assert(list_length(stmt->objarg) == 2);
|
2004-06-25 23:55:59 +02:00
|
|
|
AlterOperatorOwner(stmt->object,
|
|
|
|
(TypeName *) linitial(stmt->objarg),
|
|
|
|
(TypeName *) lsecond(stmt->objarg),
|
|
|
|
newowner);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_OPCLASS:
|
|
|
|
AlterOpClassOwner(stmt->object, stmt->addname, newowner);
|
|
|
|
break;
|
|
|
|
|
2007-01-23 06:07:18 +01:00
|
|
|
case OBJECT_OPFAMILY:
|
|
|
|
AlterOpFamilyOwner(stmt->object, stmt->addname, newowner);
|
|
|
|
break;
|
|
|
|
|
2004-06-25 23:55:59 +02:00
|
|
|
case OBJECT_SCHEMA:
|
2008-02-07 22:07:55 +01:00
|
|
|
AlterSchemaOwner(strVal(linitial(stmt->object)), newowner);
|
2004-06-25 23:55:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TABLESPACE:
|
2008-02-07 22:07:55 +01:00
|
|
|
AlterTableSpaceOwner(strVal(linitial(stmt->object)), newowner);
|
2004-06-25 23:55:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TYPE:
|
|
|
|
case OBJECT_DOMAIN: /* same as TYPE */
|
|
|
|
AlterTypeOwner(stmt->object, newowner);
|
|
|
|
break;
|
|
|
|
|
2007-08-21 03:11:32 +02:00
|
|
|
case OBJECT_TSDICTIONARY:
|
|
|
|
AlterTSDictionaryOwner(stmt->object, newowner);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_TSCONFIGURATION:
|
|
|
|
AlterTSConfigurationOwner(stmt->object, newowner);
|
|
|
|
break;
|
|
|
|
|
2008-12-19 17:25:19 +01:00
|
|
|
case OBJECT_FDW:
|
|
|
|
AlterForeignDataWrapperOwner(strVal(linitial(stmt->object)),
|
|
|
|
newowner);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBJECT_FOREIGN_SERVER:
|
|
|
|
AlterForeignServerOwner(strVal(linitial(stmt->object)), newowner);
|
|
|
|
break;
|
|
|
|
|
2004-06-25 23:55:59 +02:00
|
|
|
default:
|
|
|
|
elog(ERROR, "unrecognized AlterOwnerStmt type: %d",
|
|
|
|
(int) stmt->objectType);
|
|
|
|
}
|
|
|
|
}
|