pgsql-v9.3-alter-reworks.1-schema.v4.patch
application/octet-stream
Filename: pgsql-v9.3-alter-reworks.1-schema.v4.patch
Type: application/octet-stream
Part: 0
Message:
Re: ALTER command reworks
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
Series: patch v9
| File | + | − |
|---|---|---|
| src/backend/catalog/objectaddress.c | 241 | 1 |
| src/backend/commands/alter.c | 50 | 0 |
| src/backend/commands/collationcmds.c | 2 | 0 |
| src/backend/commands/conversioncmds.c | 0 | 0 |
| src/backend/commands/dropcmds.c | 0 | 1 |
| src/backend/commands/functioncmds.c | 7 | 0 |
| src/backend/commands/opclasscmds.c | 0 | 0 |
| src/backend/commands/operatorcmds.c | 0 | 0 |
| src/backend/commands/tsearchcmds.c | 0 | 0 |
| src/backend/nodes/copyfuncs.c | 0 | 0 |
| src/backend/nodes/equalfuncs.c | 0 | 0 |
| src/backend/parser/gram.y | 2 | 0 |
| src/include/catalog/objectaddress.h | 10 | 0 |
| src/include/commands/alter.h | 2 | 5 |
| src/include/commands/conversioncmds.h | 0 | 0 |
| src/include/commands/defrem.h | 0 | 0 |
| src/include/nodes/parsenodes.h | 0 | 0 |
*** a/src/backend/catalog/objectaddress.c
--- b/src/backend/catalog/objectaddress.c
***************
*** 63,69 ****
#include "rewrite/rewriteSupport.h"
#include "storage/lmgr.h"
#include "storage/sinval.h"
- #include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
--- 63,68 ----
***************
*** 81,87 **** typedef struct
--- 80,91 ----
Oid class_oid; /* oid of catalog */
Oid oid_index_oid; /* oid of index on system oid column */
int oid_catcache_id; /* id of catcache on system oid column */
+ int name_catcache_id; /* id of catcache on (name,namespace) */
+ AttrNumber attnum_name; /* attnum of name field */
AttrNumber attnum_namespace; /* attnum of namespace field */
+ AttrNumber attnum_owner; /* attnum of owner field */
+ AttrNumber attnum_acl; /* attnum of acl field */
+ AclObjectKind acl_kind; /* ACL_KIND_* of this object type */
} ObjectPropertyType;
static ObjectPropertyType ObjectProperty[] =
***************
*** 90,246 **** static ObjectPropertyType ObjectProperty[] =
CastRelationId,
CastOidIndexId,
-1,
! InvalidAttrNumber
},
{
CollationRelationId,
CollationOidIndexId,
COLLOID,
! Anum_pg_collation_collnamespace
},
{
ConstraintRelationId,
ConstraintOidIndexId,
CONSTROID,
! Anum_pg_constraint_connamespace
},
{
ConversionRelationId,
ConversionOidIndexId,
CONVOID,
! Anum_pg_conversion_connamespace
},
{
DatabaseRelationId,
DatabaseOidIndexId,
DATABASEOID,
! InvalidAttrNumber
},
{
ExtensionRelationId,
ExtensionOidIndexId,
-1,
! InvalidAttrNumber /* extension doesn't belong to extnamespace */
},
{
ForeignDataWrapperRelationId,
ForeignDataWrapperOidIndexId,
FOREIGNDATAWRAPPEROID,
! InvalidAttrNumber
},
{
ForeignServerRelationId,
ForeignServerOidIndexId,
FOREIGNSERVEROID,
! InvalidAttrNumber
},
{
ProcedureRelationId,
ProcedureOidIndexId,
PROCOID,
! Anum_pg_proc_pronamespace
},
{
LanguageRelationId,
LanguageOidIndexId,
LANGOID,
InvalidAttrNumber,
},
{
LargeObjectMetadataRelationId,
LargeObjectMetadataOidIndexId,
-1,
! InvalidAttrNumber
},
{
OperatorClassRelationId,
OpclassOidIndexId,
CLAOID,
Anum_pg_opclass_opcnamespace,
},
{
OperatorRelationId,
OperatorOidIndexId,
OPEROID,
! Anum_pg_operator_oprnamespace
},
{
OperatorFamilyRelationId,
OpfamilyOidIndexId,
OPFAMILYOID,
! Anum_pg_opfamily_opfnamespace
},
{
AuthIdRelationId,
AuthIdOidIndexId,
AUTHOID,
! InvalidAttrNumber
},
{
RewriteRelationId,
RewriteOidIndexId,
-1,
! InvalidAttrNumber
},
{
NamespaceRelationId,
NamespaceOidIndexId,
NAMESPACEOID,
! InvalidAttrNumber
},
{
RelationRelationId,
ClassOidIndexId,
RELOID,
! Anum_pg_class_relnamespace
},
{
TableSpaceRelationId,
TablespaceOidIndexId,
TABLESPACEOID,
! InvalidAttrNumber
},
{
TriggerRelationId,
TriggerOidIndexId,
-1,
! InvalidAttrNumber
},
{
EventTriggerRelationId,
EventTriggerOidIndexId,
! -1,
! InvalidAttrNumber
},
{
TSConfigRelationId,
TSConfigOidIndexId,
TSCONFIGOID,
! Anum_pg_ts_config_cfgnamespace
},
{
TSDictionaryRelationId,
TSDictionaryOidIndexId,
TSDICTOID,
! Anum_pg_ts_dict_dictnamespace
},
{
TSParserRelationId,
TSParserOidIndexId,
TSPARSEROID,
! Anum_pg_ts_parser_prsnamespace
},
{
TSTemplateRelationId,
TSTemplateOidIndexId,
TSTEMPLATEOID,
Anum_pg_ts_template_tmplnamespace,
},
{
TypeRelationId,
TypeOidIndexId,
TYPEOID,
! Anum_pg_type_typnamespace
}
};
--- 94,380 ----
CastRelationId,
CastOidIndexId,
-1,
! -1,
! InvalidAttrNumber,
! InvalidAttrNumber,
! InvalidAttrNumber,
! InvalidAttrNumber,
! -1
},
{
CollationRelationId,
CollationOidIndexId,
COLLOID,
! -1, /* COLLNAMEENCNSP also takes encoding */
! Anum_pg_collation_collname,
! Anum_pg_collation_collnamespace,
! Anum_pg_collation_collowner,
! InvalidAttrNumber,
! ACL_KIND_COLLATION
},
{
ConstraintRelationId,
ConstraintOidIndexId,
CONSTROID,
! -1,
! Anum_pg_constraint_conname,
! Anum_pg_constraint_connamespace,
! InvalidAttrNumber,
! InvalidAttrNumber,
! -1
},
{
ConversionRelationId,
ConversionOidIndexId,
CONVOID,
! CONNAMENSP,
! Anum_pg_conversion_conname,
! Anum_pg_conversion_connamespace,
! Anum_pg_conversion_conowner,
! InvalidAttrNumber,
! ACL_KIND_CONVERSION
},
{
DatabaseRelationId,
DatabaseOidIndexId,
DATABASEOID,
! -1,
! Anum_pg_database_datname,
! InvalidAttrNumber,
! Anum_pg_database_datdba,
! Anum_pg_database_datacl,
! ACL_KIND_DATABASE
},
{
ExtensionRelationId,
ExtensionOidIndexId,
-1,
! -1,
! Anum_pg_extension_extname,
! InvalidAttrNumber, /* extension doesn't belong to extnamespace */
! Anum_pg_extension_extowner,
! InvalidAttrNumber,
! ACL_KIND_EXTENSION
},
{
ForeignDataWrapperRelationId,
ForeignDataWrapperOidIndexId,
FOREIGNDATAWRAPPEROID,
! FOREIGNDATAWRAPPERNAME,
! Anum_pg_foreign_data_wrapper_fdwname,
! InvalidAttrNumber,
! Anum_pg_foreign_data_wrapper_fdwowner,
! Anum_pg_foreign_data_wrapper_fdwacl,
! ACL_KIND_FDW
},
{
ForeignServerRelationId,
ForeignServerOidIndexId,
FOREIGNSERVEROID,
! FOREIGNSERVERNAME,
! Anum_pg_foreign_server_srvname,
! InvalidAttrNumber,
! Anum_pg_foreign_server_srvowner,
! Anum_pg_foreign_server_srvacl,
! ACL_KIND_FOREIGN_SERVER
},
{
ProcedureRelationId,
ProcedureOidIndexId,
PROCOID,
! -1, /* PROCNAMEARGSNSP also takes argument types */
! Anum_pg_proc_proname,
! Anum_pg_proc_pronamespace,
! Anum_pg_proc_proowner,
! Anum_pg_proc_proacl,
! ACL_KIND_PROC
},
{
LanguageRelationId,
LanguageOidIndexId,
LANGOID,
+ LANGNAME,
+ Anum_pg_language_lanname,
InvalidAttrNumber,
+ Anum_pg_language_lanowner,
+ Anum_pg_language_lanacl,
+ ACL_KIND_LANGUAGE
},
{
LargeObjectMetadataRelationId,
LargeObjectMetadataOidIndexId,
-1,
! -1,
! InvalidAttrNumber,
! InvalidAttrNumber,
! Anum_pg_largeobject_metadata_lomowner,
! Anum_pg_largeobject_metadata_lomacl,
! ACL_KIND_LARGEOBJECT
},
{
OperatorClassRelationId,
OpclassOidIndexId,
CLAOID,
+ -1, /* CLAAMNAMENSP also takes opcmethod */
+ Anum_pg_opclass_opcname,
Anum_pg_opclass_opcnamespace,
+ Anum_pg_opclass_opcowner,
+ InvalidAttrNumber,
+ ACL_KIND_OPCLASS
},
{
OperatorRelationId,
OperatorOidIndexId,
OPEROID,
! -1, /* OPERNAMENSP also takes left and right type */
! Anum_pg_operator_oprname,
! Anum_pg_operator_oprnamespace,
! Anum_pg_operator_oprowner,
! InvalidAttrNumber,
! ACL_KIND_OPER
},
{
OperatorFamilyRelationId,
OpfamilyOidIndexId,
OPFAMILYOID,
! -1, /* OPFAMILYAMNAMENSP also takes opfmethod */
! Anum_pg_opfamily_opfname,
! Anum_pg_opfamily_opfnamespace,
! Anum_pg_opfamily_opfowner,
! InvalidAttrNumber,
! ACL_KIND_OPFAMILY
},
{
AuthIdRelationId,
AuthIdOidIndexId,
AUTHOID,
! AUTHNAME,
! Anum_pg_authid_rolname,
! InvalidAttrNumber,
! InvalidAttrNumber,
! InvalidAttrNumber,
! -1
},
{
RewriteRelationId,
RewriteOidIndexId,
-1,
! -1,
! Anum_pg_rewrite_rulename,
! InvalidAttrNumber,
! InvalidAttrNumber,
! InvalidAttrNumber,
! -1
},
{
NamespaceRelationId,
NamespaceOidIndexId,
NAMESPACEOID,
! NAMESPACENAME,
! Anum_pg_namespace_nspname,
! InvalidAttrNumber,
! Anum_pg_namespace_nspowner,
! Anum_pg_namespace_nspacl,
! ACL_KIND_NAMESPACE
},
{
RelationRelationId,
ClassOidIndexId,
RELOID,
! RELNAMENSP,
! Anum_pg_class_relname,
! Anum_pg_class_relnamespace,
! Anum_pg_class_relowner,
! Anum_pg_class_relacl,
! ACL_KIND_CLASS
},
{
TableSpaceRelationId,
TablespaceOidIndexId,
TABLESPACEOID,
! -1,
! Anum_pg_tablespace_spcname,
! InvalidAttrNumber,
! Anum_pg_tablespace_spcowner,
! Anum_pg_tablespace_spcacl,
! ACL_KIND_TABLESPACE
},
{
TriggerRelationId,
TriggerOidIndexId,
-1,
! -1,
! Anum_pg_trigger_tgname,
! InvalidAttrNumber,
! InvalidAttrNumber,
! InvalidAttrNumber,
! -1,
},
{
EventTriggerRelationId,
EventTriggerOidIndexId,
! EVENTTRIGGEROID,
! EVENTTRIGGERNAME,
! Anum_pg_event_trigger_evtname,
! InvalidAttrNumber,
! Anum_pg_event_trigger_evtowner,
! InvalidAttrNumber,
! ACL_KIND_EVENT_TRIGGER,
},
{
TSConfigRelationId,
TSConfigOidIndexId,
TSCONFIGOID,
! TSCONFIGNAMENSP,
! Anum_pg_ts_config_cfgname,
! Anum_pg_ts_config_cfgnamespace,
! Anum_pg_ts_config_cfgowner,
! InvalidAttrNumber,
! ACL_KIND_TSCONFIGURATION
},
{
TSDictionaryRelationId,
TSDictionaryOidIndexId,
TSDICTOID,
! TSDICTNAMENSP,
! Anum_pg_ts_dict_dictname,
! Anum_pg_ts_dict_dictnamespace,
! Anum_pg_ts_dict_dictowner,
! InvalidAttrNumber,
! ACL_KIND_TSDICTIONARY
},
{
TSParserRelationId,
TSParserOidIndexId,
TSPARSEROID,
! TSPARSERNAMENSP,
! Anum_pg_ts_parser_prsname,
! Anum_pg_ts_parser_prsnamespace,
! InvalidAttrNumber,
! InvalidAttrNumber,
! -1,
},
{
TSTemplateRelationId,
TSTemplateOidIndexId,
TSTEMPLATEOID,
+ TSTEMPLATENAMENSP,
+ Anum_pg_ts_template_tmplname,
Anum_pg_ts_template_tmplnamespace,
+ InvalidAttrNumber,
+ InvalidAttrNumber,
+ -1,
},
{
TypeRelationId,
TypeOidIndexId,
TYPEOID,
! TYPENAMENSP,
! Anum_pg_type_typname,
! Anum_pg_type_typnamespace,
! Anum_pg_type_typowner,
! Anum_pg_type_typacl,
! ACL_KIND_TYPE
}
};
***************
*** 1133,1149 **** get_object_namespace(const ObjectAddress *address)
}
/*
* Find ObjectProperty structure by class_id.
*/
static ObjectPropertyType *
get_object_property_data(Oid class_id)
{
int index;
for (index = 0; index < lengthof(ObjectProperty); index++)
if (ObjectProperty[index].class_oid == class_id)
return &ObjectProperty[index];
! elog(ERROR, "unrecognized class id: %u", class_id);
! return NULL; /* not reached */
}
--- 1267,1363 ----
}
/*
+ * Interfaces to reference fields of ObjectPropertyType
+ */
+ Oid
+ get_object_oid_index(Oid class_id)
+ {
+ ObjectPropertyType *prop = get_object_property_data(class_id);
+
+ return prop->oid_index_oid;
+ }
+
+ int
+ get_object_catcache_oid(Oid class_id)
+ {
+ ObjectPropertyType *prop = get_object_property_data(class_id);
+
+ return prop->oid_catcache_id;
+ }
+
+ int
+ get_object_catcache_name(Oid class_id)
+ {
+ ObjectPropertyType *prop = get_object_property_data(class_id);
+
+ return prop->name_catcache_id;
+ }
+
+ AttrNumber
+ get_object_attnum_name(Oid class_id)
+ {
+ ObjectPropertyType *prop = get_object_property_data(class_id);
+
+ return prop->attnum_name;
+ }
+
+ AttrNumber
+ get_object_attnum_namespace(Oid class_id)
+ {
+ ObjectPropertyType *prop = get_object_property_data(class_id);
+
+ return prop->attnum_namespace;
+ }
+
+ AttrNumber
+ get_object_attnum_owner(Oid class_id)
+ {
+ ObjectPropertyType *prop = get_object_property_data(class_id);
+
+ return prop->attnum_owner;
+ }
+
+ AttrNumber
+ get_object_attnum_acl(Oid class_id)
+ {
+ ObjectPropertyType *prop = get_object_property_data(class_id);
+
+ return prop->attnum_acl;
+ }
+
+ AclObjectKind
+ get_object_aclkind(Oid class_id)
+ {
+ ObjectPropertyType *prop = get_object_property_data(class_id);
+
+ return prop->acl_kind;
+ }
+
+ /*
* Find ObjectProperty structure by class_id.
*/
static ObjectPropertyType *
get_object_property_data(Oid class_id)
{
+ static ObjectPropertyType *prop_last = NULL;
int index;
+ /*
+ * A shortcut to speed up multiple consecutive lookups of a particular
+ * object class.
+ */
+ if (prop_last && prop_last->class_oid == class_id)
+ return prop_last;
+
for (index = 0; index < lengthof(ObjectProperty); index++)
+ {
if (ObjectProperty[index].class_oid == class_id)
+ {
+ prop_last = &ObjectProperty[index];
return &ObjectProperty[index];
+ }
+ }
! ereport(ERROR,
! (errmsg_internal("unrecognized class id: %u", class_id)));
}
*** a/src/backend/commands/alter.c
--- b/src/backend/commands/alter.c
***************
*** 173,182 **** ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
AlterCollationNamespace(stmt->object, stmt->newschema);
break;
- case OBJECT_CONVERSION:
- AlterConversionNamespace(stmt->object, stmt->newschema);
- break;
-
case OBJECT_EXTENSION:
AlterExtensionNamespace(stmt->object, stmt->newschema);
break;
--- 173,178 ----
***************
*** 186,203 **** ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
stmt->newschema);
break;
- case OBJECT_OPERATOR:
- AlterOperatorNamespace(stmt->object, stmt->objarg, stmt->newschema);
- break;
-
- case OBJECT_OPCLASS:
- AlterOpClassNamespace(stmt->object, stmt->addname, stmt->newschema);
- break;
-
- case OBJECT_OPFAMILY:
- AlterOpFamilyNamespace(stmt->object, stmt->addname, stmt->newschema);
- break;
-
case OBJECT_SEQUENCE:
case OBJECT_TABLE:
case OBJECT_VIEW:
--- 182,187 ----
***************
*** 205,229 **** ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
AlterTableNamespace(stmt);
break;
! 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;
!
! case OBJECT_TYPE:
! case OBJECT_DOMAIN:
! AlterTypeNamespace(stmt->object, stmt->newschema, stmt->objectType);
break;
default:
--- 189,230 ----
AlterTableNamespace(stmt);
break;
! case OBJECT_TYPE:
! case OBJECT_DOMAIN:
! AlterTypeNamespace(stmt->object, stmt->newschema, stmt->objectType);
break;
+ /* generic code path */
+ case OBJECT_CONVERSION:
+ case OBJECT_OPERATOR:
+ case OBJECT_OPCLASS:
+ case OBJECT_OPFAMILY:
+ case OBJECT_TSPARSER:
case OBJECT_TSDICTIONARY:
case OBJECT_TSTEMPLATE:
case OBJECT_TSCONFIGURATION:
! {
! Relation catalog;
! Relation relation;
! Oid classId;
! Oid nspOid;
! ObjectAddress address;
!
! address = get_object_address(stmt->objectType,
! stmt->object,
! stmt->objarg,
! &relation,
! AccessExclusiveLock,
! false);
! Assert(relation == NULL);
! classId = address.classId;
! catalog = heap_open(classId, RowExclusiveLock);
! nspOid = LookupCreationNamespace(stmt->newschema);
!
! AlterObjectNamespace_internal(catalog, address.objectId,
! nspOid);
! heap_close(catalog, RowExclusiveLock);
! }
break;
default:
***************
*** 293,327 **** AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid)
break;
case OCLASS_CONVERSION:
- oldNspOid = AlterConversionNamespace_oid(objid, nspOid);
- break;
-
case OCLASS_OPERATOR:
- oldNspOid = AlterOperatorNamespace_oid(objid, nspOid);
- break;
-
case OCLASS_OPCLASS:
- oldNspOid = AlterOpClassNamespace_oid(objid, nspOid);
- break;
-
case OCLASS_OPFAMILY:
- oldNspOid = AlterOpFamilyNamespace_oid(objid, nspOid);
- break;
-
case OCLASS_TSPARSER:
- oldNspOid = AlterTSParserNamespace_oid(objid, nspOid);
- break;
-
case OCLASS_TSDICT:
- oldNspOid = AlterTSDictionaryNamespace_oid(objid, nspOid);
- break;
-
case OCLASS_TSTEMPLATE:
- oldNspOid = AlterTSTemplateNamespace_oid(objid, nspOid);
- break;
-
case OCLASS_TSCONFIG:
! oldNspOid = AlterTSConfigurationNamespace_oid(objid, nspOid);
break;
default:
--- 294,316 ----
break;
case OCLASS_CONVERSION:
case OCLASS_OPERATOR:
case OCLASS_OPCLASS:
case OCLASS_OPFAMILY:
case OCLASS_TSPARSER:
case OCLASS_TSDICT:
case OCLASS_TSTEMPLATE:
case OCLASS_TSCONFIG:
! {
! Relation catalog;
!
! catalog = heap_open(classId, RowExclusiveLock);
!
! oldNspOid = AlterObjectNamespace_internal(catalog, objid,
! nspOid);
!
! heap_close(catalog, RowExclusiveLock);
! }
break;
default:
***************
*** 336,367 **** AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid)
* cases (won't work for tables, nor other cases where we need to do more
* than change the namespace column of a single catalog entry).
*
- * The AlterFooNamespace() calls just above will call a function whose job
- * is to lookup the arguments for the generic function here.
- *
* rel: catalog relation containing object (RowExclusiveLock'd by caller)
- * oidCacheId: syscache that indexes this catalog by OID
- * nameCacheId: syscache that indexes this catalog by name and namespace
- * (pass -1 if there is none)
* objid: OID of object to change the namespace of
* nspOid: OID of new namespace
- * Anum_name: column number of catalog's name column
- * Anum_namespace: column number of catalog's namespace column
- * Anum_owner: column number of catalog's owner column, or -1 if none
- * acl_kind: ACL type for object, or -1 if none assigned
- *
- * If the object does not have an owner or permissions, pass -1 for
- * Anum_owner and acl_kind. In this case the calling user must be superuser.
*
* Returns the OID of the object's previous namespace.
*/
Oid
! AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId,
! Oid objid, Oid nspOid,
! int Anum_name, int Anum_namespace, int Anum_owner,
! AclObjectKind acl_kind)
{
Oid classId = RelationGetRelid(rel);
Oid oldNspOid;
Datum name,
namespace;
--- 325,346 ----
* cases (won't work for tables, nor other cases where we need to do more
* than change the namespace column of a single catalog entry).
*
* rel: catalog relation containing object (RowExclusiveLock'd by caller)
* objid: OID of object to change the namespace of
* nspOid: OID of new namespace
*
* Returns the OID of the object's previous namespace.
*/
Oid
! AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid)
{
Oid classId = RelationGetRelid(rel);
+ int oidCacheId = get_object_catcache_oid(classId);
+ int nameCacheId = get_object_catcache_name(classId);
+ AttrNumber Anum_name = get_object_attnum_name(classId);
+ AttrNumber Anum_namespace = get_object_attnum_namespace(classId);
+ AttrNumber Anum_owner = get_object_attnum_owner(classId);
+ AclObjectKind acl_kind = get_object_aclkind(classId);
Oid oldNspOid;
Datum name,
namespace;
***************
*** 379,385 **** AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId,
name = heap_getattr(tup, Anum_name, RelationGetDescr(rel), &isnull);
Assert(!isnull);
! namespace = heap_getattr(tup, Anum_namespace, RelationGetDescr(rel), &isnull);
Assert(!isnull);
oldNspOid = DatumGetObjectId(namespace);
--- 358,365 ----
name = heap_getattr(tup, Anum_name, RelationGetDescr(rel), &isnull);
Assert(!isnull);
! namespace = heap_getattr(tup, Anum_namespace, RelationGetDescr(rel),
! &isnull);
Assert(!isnull);
oldNspOid = DatumGetObjectId(namespace);
*** a/src/backend/commands/collationcmds.c
--- b/src/backend/commands/collationcmds.c
***************
*** 339,345 **** AlterCollationNamespace_oid(Oid collOid, Oid newNspOid)
/*
* We have to check for name collision ourselves, because
! * AlterObjectNamespace doesn't know how to deal with the encoding
* considerations.
*/
collation_name = get_collation_name(collOid);
--- 339,345 ----
/*
* We have to check for name collision ourselves, because
! * AlterObjectNamespace_internal doesn't know how to deal with the encoding
* considerations.
*/
collation_name = get_collation_name(collOid);
***************
*** 370,381 **** AlterCollationNamespace_oid(Oid collOid, Oid newNspOid)
get_namespace_name(newNspOid))));
/* OK, do the work */
! oldNspOid = AlterObjectNamespace(rel, COLLOID, -1,
! collOid, newNspOid,
! Anum_pg_collation_collname,
! Anum_pg_collation_collnamespace,
! Anum_pg_collation_collowner,
! ACL_KIND_COLLATION);
heap_close(rel, RowExclusiveLock);
--- 370,376 ----
get_namespace_name(newNspOid))));
/* OK, do the work */
! oldNspOid = AlterObjectNamespace_internal(rel, collOid, newNspOid);
heap_close(rel, RowExclusiveLock);
*** a/src/backend/commands/conversioncmds.c
--- b/src/backend/commands/conversioncmds.c
***************
*** 266,318 **** AlterConversionOwner_internal(Relation rel, Oid conversionOid, Oid newOwnerId)
heap_freetuple(tup);
}
-
- /*
- * Execute ALTER CONVERSION SET SCHEMA
- */
- void
- AlterConversionNamespace(List *name, const char *newschema)
- {
- Oid convOid,
- nspOid;
- Relation rel;
-
- rel = heap_open(ConversionRelationId, RowExclusiveLock);
-
- convOid = get_conversion_oid(name, false);
-
- /* get schema OID */
- nspOid = LookupCreationNamespace(newschema);
-
- AlterObjectNamespace(rel, CONVOID, CONNAMENSP,
- convOid, nspOid,
- Anum_pg_conversion_conname,
- Anum_pg_conversion_connamespace,
- Anum_pg_conversion_conowner,
- ACL_KIND_CONVERSION);
-
- heap_close(rel, RowExclusiveLock);
- }
-
- /*
- * Change conversion schema, by oid
- */
- Oid
- AlterConversionNamespace_oid(Oid convOid, Oid newNspOid)
- {
- Oid oldNspOid;
- Relation rel;
-
- rel = heap_open(ConversionRelationId, RowExclusiveLock);
-
- oldNspOid = AlterObjectNamespace(rel, CONVOID, CONNAMENSP,
- convOid, newNspOid,
- Anum_pg_conversion_conname,
- Anum_pg_conversion_connamespace,
- Anum_pg_conversion_conowner,
- ACL_KIND_CONVERSION);
-
- heap_close(rel, RowExclusiveLock);
-
- return oldNspOid;
- }
--- 266,268 ----
*** a/src/backend/commands/dropcmds.c
--- b/src/backend/commands/dropcmds.c
***************
*** 26,32 ****
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "parser/parse_type.h"
- #include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
--- 26,31 ----
*** a/src/backend/commands/functioncmds.c
--- b/src/backend/commands/functioncmds.c
***************
*** 1851,1871 **** AlterFunctionNamespace_oid(Oid procOid, Oid nspOid)
procRel = heap_open(ProcedureRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for function %u", procOid);
proc = (Form_pg_proc) GETSTRUCT(tup);
- /* check permissions on function */
- if (!pg_proc_ownercheck(procOid, GetUserId()))
- aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
- NameStr(proc->proname));
-
- oldNspOid = proc->pronamespace;
-
- /* common checks on switching namespaces */
- CheckSetNamespace(oldNspOid, nspOid, ProcedureRelationId, procOid);
-
/* check for duplicate name (more friendly than unique-index failure) */
if (SearchSysCacheExists3(PROCNAMEARGSNSP,
CStringGetDatum(NameStr(proc->proname)),
--- 1851,1866 ----
procRel = heap_open(ProcedureRelationId, RowExclusiveLock);
+ /*
+ * We have to check for name collisions ourselves, because
+ * AlterObjectNamespace_internal doesn't know how to deal with the
+ * argument types.
+ */
tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for function %u", procOid);
proc = (Form_pg_proc) GETSTRUCT(tup);
/* check for duplicate name (more friendly than unique-index failure) */
if (SearchSysCacheExists3(PROCNAMEARGSNSP,
CStringGetDatum(NameStr(proc->proname)),
***************
*** 1877,1897 **** AlterFunctionNamespace_oid(Oid procOid, Oid nspOid)
NameStr(proc->proname),
get_namespace_name(nspOid))));
! /* OK, modify the pg_proc row */
!
! /* tup is a copy, so we can scribble directly on it */
! proc->pronamespace = nspOid;
!
! simple_heap_update(procRel, &tup->t_self, tup);
! CatalogUpdateIndexes(procRel, tup);
!
! /* Update dependency on schema */
! if (changeDependencyFor(ProcedureRelationId, procOid,
! NamespaceRelationId, oldNspOid, nspOid) != 1)
! elog(ERROR, "failed to change schema dependency for function \"%s\"",
! NameStr(proc->proname));
!
! heap_freetuple(tup);
heap_close(procRel, RowExclusiveLock);
--- 1872,1879 ----
NameStr(proc->proname),
get_namespace_name(nspOid))));
! /* OK, do the work */
! oldNspOid = AlterObjectNamespace_internal(procRel, procOid, nspOid);
heap_close(procRel, RowExclusiveLock);
*** a/src/backend/commands/opclasscmds.c
--- b/src/backend/commands/opclasscmds.c
***************
*** 1915,1972 **** AlterOpClassOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
}
/*
- * ALTER OPERATOR CLASS any_name USING access_method SET SCHEMA name
- */
- void
- AlterOpClassNamespace(List *name, char *access_method, const char *newschema)
- {
- Oid amOid;
- Relation rel;
- Oid opclassOid;
- Oid nspOid;
-
- amOid = get_am_oid(access_method, false);
-
- rel = heap_open(OperatorClassRelationId, RowExclusiveLock);
-
- /* Look up the opclass */
- opclassOid = get_opclass_oid(amOid, name, false);
-
- /* get schema OID */
- nspOid = LookupCreationNamespace(newschema);
-
- AlterObjectNamespace(rel, CLAOID, -1,
- opclassOid, nspOid,
- Anum_pg_opclass_opcname,
- Anum_pg_opclass_opcnamespace,
- Anum_pg_opclass_opcowner,
- ACL_KIND_OPCLASS);
-
- heap_close(rel, RowExclusiveLock);
- }
-
- Oid
- AlterOpClassNamespace_oid(Oid opclassOid, Oid newNspOid)
- {
- Oid oldNspOid;
- Relation rel;
-
- rel = heap_open(OperatorClassRelationId, RowExclusiveLock);
-
- oldNspOid =
- AlterObjectNamespace(rel, CLAOID, -1,
- opclassOid, newNspOid,
- Anum_pg_opclass_opcname,
- Anum_pg_opclass_opcnamespace,
- Anum_pg_opclass_opcowner,
- ACL_KIND_OPCLASS);
-
- heap_close(rel, RowExclusiveLock);
-
- return oldNspOid;
- }
-
- /*
* Change opfamily owner by name
*/
void
--- 1915,1920 ----
***************
*** 2122,2176 **** get_am_oid(const char *amname, bool missing_ok)
errmsg("access method \"%s\" does not exist", amname)));
return oid;
}
-
- /*
- * ALTER OPERATOR FAMILY any_name USING access_method SET SCHEMA name
- */
- void
- AlterOpFamilyNamespace(List *name, char *access_method, const char *newschema)
- {
- Oid amOid;
- Relation rel;
- Oid opfamilyOid;
- Oid nspOid;
-
- amOid = get_am_oid(access_method, false);
-
- rel = heap_open(OperatorFamilyRelationId, RowExclusiveLock);
-
- /* Look up the opfamily */
- opfamilyOid = get_opfamily_oid(amOid, name, false);
-
- /* get schema OID */
- nspOid = LookupCreationNamespace(newschema);
-
- AlterObjectNamespace(rel, OPFAMILYOID, -1,
- opfamilyOid, nspOid,
- Anum_pg_opfamily_opfname,
- Anum_pg_opfamily_opfnamespace,
- Anum_pg_opfamily_opfowner,
- ACL_KIND_OPFAMILY);
-
- heap_close(rel, RowExclusiveLock);
- }
-
- Oid
- AlterOpFamilyNamespace_oid(Oid opfamilyOid, Oid newNspOid)
- {
- Oid oldNspOid;
- Relation rel;
-
- rel = heap_open(OperatorFamilyRelationId, RowExclusiveLock);
-
- oldNspOid =
- AlterObjectNamespace(rel, OPFAMILYOID, -1,
- opfamilyOid, newNspOid,
- Anum_pg_opfamily_opfname,
- Anum_pg_opfamily_opfnamespace,
- Anum_pg_opfamily_opfowner,
- ACL_KIND_OPFAMILY);
-
- heap_close(rel, RowExclusiveLock);
-
- return oldNspOid;
- }
--- 2070,2072 ----
*** a/src/backend/commands/operatorcmds.c
--- b/src/backend/commands/operatorcmds.c
***************
*** 423,478 **** AlterOperatorOwner_internal(Relation rel, Oid operOid, Oid newOwnerId)
heap_freetuple(tup);
}
-
- /*
- * Execute ALTER OPERATOR SET SCHEMA
- */
- void
- AlterOperatorNamespace(List *names, List *argtypes, const char *newschema)
- {
- List *operatorName = names;
- TypeName *typeName1 = (TypeName *) linitial(argtypes);
- TypeName *typeName2 = (TypeName *) lsecond(argtypes);
- Oid operOid,
- nspOid;
- Relation rel;
-
- rel = heap_open(OperatorRelationId, RowExclusiveLock);
-
- Assert(list_length(argtypes) == 2);
- operOid = LookupOperNameTypeNames(NULL, operatorName,
- typeName1, typeName2,
- false, -1);
-
- /* get schema OID */
- nspOid = LookupCreationNamespace(newschema);
-
- AlterObjectNamespace(rel, OPEROID, -1,
- operOid, nspOid,
- Anum_pg_operator_oprname,
- Anum_pg_operator_oprnamespace,
- Anum_pg_operator_oprowner,
- ACL_KIND_OPER);
-
- heap_close(rel, RowExclusiveLock);
- }
-
- Oid
- AlterOperatorNamespace_oid(Oid operOid, Oid newNspOid)
- {
- Oid oldNspOid;
- Relation rel;
-
- rel = heap_open(OperatorRelationId, RowExclusiveLock);
-
- oldNspOid = AlterObjectNamespace(rel, OPEROID, -1,
- operOid, newNspOid,
- Anum_pg_operator_oprname,
- Anum_pg_operator_oprnamespace,
- Anum_pg_operator_oprowner,
- ACL_KIND_OPER);
-
- heap_close(rel, RowExclusiveLock);
-
- return oldNspOid;
- }
--- 423,425 ----
*** a/src/backend/commands/tsearchcmds.c
--- b/src/backend/commands/tsearchcmds.c
***************
*** 346,397 **** RenameTSParser(List *oldname, const char *newname)
heap_freetuple(tup);
}
- /*
- * ALTER TEXT SEARCH PARSER any_name SET SCHEMA name
- */
- void
- AlterTSParserNamespace(List *name, const char *newschema)
- {
- Oid prsId,
- nspOid;
- Relation rel;
-
- rel = heap_open(TSParserRelationId, RowExclusiveLock);
-
- prsId = get_ts_parser_oid(name, false);
-
- /* get schema OID */
- nspOid = LookupCreationNamespace(newschema);
-
- AlterObjectNamespace(rel, TSPARSEROID, TSPARSERNAMENSP,
- prsId, nspOid,
- Anum_pg_ts_parser_prsname,
- Anum_pg_ts_parser_prsnamespace,
- -1, -1);
-
- heap_close(rel, RowExclusiveLock);
- }
-
- Oid
- AlterTSParserNamespace_oid(Oid prsId, Oid newNspOid)
- {
- Oid oldNspOid;
- Relation rel;
-
- rel = heap_open(TSParserRelationId, RowExclusiveLock);
-
- oldNspOid =
- AlterObjectNamespace(rel, TSPARSEROID, TSPARSERNAMENSP,
- prsId, newNspOid,
- Anum_pg_ts_parser_prsname,
- Anum_pg_ts_parser_prsnamespace,
- -1, -1);
-
- heap_close(rel, RowExclusiveLock);
-
- return oldNspOid;
- }
-
/* ---------------------- TS Dictionary commands -----------------------*/
/*
--- 346,351 ----
***************
*** 626,679 **** RenameTSDictionary(List *oldname, const char *newname)
}
/*
- * ALTER TEXT SEARCH DICTIONARY any_name SET SCHEMA name
- */
- void
- AlterTSDictionaryNamespace(List *name, const char *newschema)
- {
- Oid dictId,
- nspOid;
- Relation rel;
-
- rel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
-
- dictId = get_ts_dict_oid(name, false);
-
- /* get schema OID */
- nspOid = LookupCreationNamespace(newschema);
-
- AlterObjectNamespace(rel, TSDICTOID, TSDICTNAMENSP,
- dictId, nspOid,
- Anum_pg_ts_dict_dictname,
- Anum_pg_ts_dict_dictnamespace,
- Anum_pg_ts_dict_dictowner,
- ACL_KIND_TSDICTIONARY);
-
- heap_close(rel, RowExclusiveLock);
- }
-
- Oid
- AlterTSDictionaryNamespace_oid(Oid dictId, Oid newNspOid)
- {
- Oid oldNspOid;
- Relation rel;
-
- rel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
-
- oldNspOid =
- AlterObjectNamespace(rel, TSDICTOID, TSDICTNAMENSP,
- dictId, newNspOid,
- Anum_pg_ts_dict_dictname,
- Anum_pg_ts_dict_dictnamespace,
- Anum_pg_ts_dict_dictowner,
- ACL_KIND_TSDICTIONARY);
-
- heap_close(rel, RowExclusiveLock);
-
- return oldNspOid;
- }
-
- /*
* Guts of TS dictionary deletion.
*/
void
--- 580,585 ----
***************
*** 1091,1142 **** RenameTSTemplate(List *oldname, const char *newname)
}
/*
- * ALTER TEXT SEARCH TEMPLATE any_name SET SCHEMA name
- */
- void
- AlterTSTemplateNamespace(List *name, const char *newschema)
- {
- Oid tmplId,
- nspOid;
- Relation rel;
-
- rel = heap_open(TSTemplateRelationId, RowExclusiveLock);
-
- tmplId = get_ts_template_oid(name, false);
-
- /* get schema OID */
- nspOid = LookupCreationNamespace(newschema);
-
- AlterObjectNamespace(rel, TSTEMPLATEOID, TSTEMPLATENAMENSP,
- tmplId, nspOid,
- Anum_pg_ts_template_tmplname,
- Anum_pg_ts_template_tmplnamespace,
- -1, -1);
-
- heap_close(rel, RowExclusiveLock);
- }
-
- Oid
- AlterTSTemplateNamespace_oid(Oid tmplId, Oid newNspOid)
- {
- Oid oldNspOid;
- Relation rel;
-
- rel = heap_open(TSTemplateRelationId, RowExclusiveLock);
-
- oldNspOid =
- AlterObjectNamespace(rel, TSTEMPLATEOID, TSTEMPLATENAMENSP,
- tmplId, newNspOid,
- Anum_pg_ts_template_tmplname,
- Anum_pg_ts_template_tmplnamespace,
- -1, -1);
-
- heap_close(rel, RowExclusiveLock);
-
- return oldNspOid;
- }
-
- /*
* Guts of TS template deletion.
*/
void
--- 997,1002 ----
***************
*** 1483,1536 **** RenameTSConfiguration(List *oldname, const char *newname)
}
/*
- * ALTER TEXT SEARCH CONFIGURATION any_name SET SCHEMA name
- */
- void
- AlterTSConfigurationNamespace(List *name, const char *newschema)
- {
- Oid cfgId,
- nspOid;
- Relation rel;
-
- rel = heap_open(TSConfigRelationId, RowExclusiveLock);
-
- cfgId = get_ts_config_oid(name, false);
-
- /* get schema OID */
- nspOid = LookupCreationNamespace(newschema);
-
- AlterObjectNamespace(rel, TSCONFIGOID, TSCONFIGNAMENSP,
- cfgId, nspOid,
- Anum_pg_ts_config_cfgname,
- Anum_pg_ts_config_cfgnamespace,
- Anum_pg_ts_config_cfgowner,
- ACL_KIND_TSCONFIGURATION);
-
- heap_close(rel, RowExclusiveLock);
- }
-
- Oid
- AlterTSConfigurationNamespace_oid(Oid cfgId, Oid newNspOid)
- {
- Oid oldNspOid;
- Relation rel;
-
- rel = heap_open(TSConfigRelationId, RowExclusiveLock);
-
- oldNspOid =
- AlterObjectNamespace(rel, TSCONFIGOID, TSCONFIGNAMENSP,
- cfgId, newNspOid,
- Anum_pg_ts_config_cfgname,
- Anum_pg_ts_config_cfgnamespace,
- Anum_pg_ts_config_cfgowner,
- ACL_KIND_TSCONFIGURATION);
-
- heap_close(rel, RowExclusiveLock);
-
- return oldNspOid;
- }
-
- /*
* Guts of TS configuration deletion.
*/
void
--- 1343,1348 ----
*** a/src/backend/nodes/copyfuncs.c
--- b/src/backend/nodes/copyfuncs.c
***************
*** 2932,2938 **** _copyAlterObjectSchemaStmt(const AlterObjectSchemaStmt *from)
COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objarg);
- COPY_STRING_FIELD(addname);
COPY_STRING_FIELD(newschema);
COPY_SCALAR_FIELD(missing_ok);
--- 2932,2937 ----
*** a/src/backend/nodes/equalfuncs.c
--- b/src/backend/nodes/equalfuncs.c
***************
*** 1336,1342 **** _equalAlterObjectSchemaStmt(const AlterObjectSchemaStmt *a, const AlterObjectSch
COMPARE_NODE_FIELD(relation);
COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objarg);
- COMPARE_STRING_FIELD(addname);
COMPARE_STRING_FIELD(newschema);
COMPARE_SCALAR_FIELD(missing_ok);
--- 1336,1341 ----
*** a/src/backend/parser/gram.y
--- b/src/backend/parser/gram.y
***************
*** 7146,7152 **** AlterObjectSchemaStmt:
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_OPCLASS;
n->object = $4;
! n->addname = $6;
n->newschema = $9;
n->missing_ok = false;
$$ = (Node *)n;
--- 7146,7152 ----
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_OPCLASS;
n->object = $4;
! n->objarg = list_make1(makeString($6));
n->newschema = $9;
n->missing_ok = false;
$$ = (Node *)n;
***************
*** 7156,7162 **** AlterObjectSchemaStmt:
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_OPFAMILY;
n->object = $4;
! n->addname = $6;
n->newschema = $9;
n->missing_ok = false;
$$ = (Node *)n;
--- 7156,7162 ----
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_OPFAMILY;
n->object = $4;
! n->objarg = list_make1(makeString($6));
n->newschema = $9;
n->missing_ok = false;
$$ = (Node *)n;
*** a/src/include/catalog/objectaddress.h
--- b/src/include/catalog/objectaddress.h
***************
*** 15,20 ****
--- 15,21 ----
#include "nodes/parsenodes.h"
#include "storage/lock.h"
+ #include "utils/acl.h"
#include "utils/relcache.h"
/*
***************
*** 37,40 **** extern void check_object_ownership(Oid roleid,
--- 38,50 ----
extern Oid get_object_namespace(const ObjectAddress *address);
+ extern Oid get_object_oid_index(Oid class_id);
+ extern int get_object_catcache_oid(Oid class_id);
+ extern int get_object_catcache_name(Oid class_id);
+ extern AttrNumber get_object_attnum_name(Oid class_id);
+ extern AttrNumber get_object_attnum_namespace(Oid class_id);
+ extern AttrNumber get_object_attnum_owner(Oid class_id);
+ extern AttrNumber get_object_attnum_acl(Oid class_id);
+ extern AclObjectKind get_object_aclkind(Oid class_id);
+
#endif /* PARSE_OBJECT_H */
*** a/src/include/commands/alter.h
--- b/src/include/commands/alter.h
***************
*** 14,29 ****
#ifndef ALTER_H
#define ALTER_H
! #include "utils/acl.h"
#include "utils/relcache.h"
extern void ExecRenameStmt(RenameStmt *stmt);
extern void ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt);
extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid);
! extern Oid AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId,
! Oid objid, Oid nspOid,
! int Anum_name, int Anum_namespace, int Anum_owner,
! AclObjectKind acl_kind);
extern void ExecAlterOwnerStmt(AlterOwnerStmt *stmt);
#endif /* ALTER_H */
--- 14,26 ----
#ifndef ALTER_H
#define ALTER_H
! #include "nodes/parsenodes.h"
#include "utils/relcache.h"
extern void ExecRenameStmt(RenameStmt *stmt);
extern void ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt);
extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid);
! extern Oid AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid);
extern void ExecAlterOwnerStmt(AlterOwnerStmt *stmt);
#endif /* ALTER_H */
*** a/src/include/commands/conversioncmds.h
--- b/src/include/commands/conversioncmds.h
***************
*** 21,27 **** extern void CreateConversionCommand(CreateConversionStmt *parsetree);
extern void RenameConversion(List *name, const char *newname);
extern void AlterConversionOwner(List *name, Oid newOwnerId);
extern void AlterConversionOwner_oid(Oid conversionOid, Oid newOwnerId);
- extern void AlterConversionNamespace(List *name, const char *newschema);
- extern Oid AlterConversionNamespace_oid(Oid convOid, Oid newNspOid);
#endif /* CONVERSIONCMDS_H */
--- 21,25 ----
*** a/src/include/commands/defrem.h
--- b/src/include/commands/defrem.h
***************
*** 64,71 **** extern void RemoveOperatorById(Oid operOid);
extern void AlterOperatorOwner(List *name, TypeName *typeName1,
TypeName *typename2, Oid newOwnerId);
extern void AlterOperatorOwner_oid(Oid operOid, Oid newOwnerId);
- extern void AlterOperatorNamespace(List *names, List *argtypes, const char *newschema);
- extern Oid AlterOperatorNamespace_oid(Oid operOid, Oid newNspOid);
/* commands/aggregatecmds.c */
extern void DefineAggregate(List *name, List *args, bool oldstyle,
--- 64,69 ----
***************
*** 85,96 **** extern void RenameOpClass(List *name, const char *access_method, const char *new
extern void RenameOpFamily(List *name, const char *access_method, const char *newname);
extern void AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId);
extern void AlterOpClassOwner_oid(Oid opclassOid, Oid newOwnerId);
- extern void AlterOpClassNamespace(List *name, char *access_method, const char *newschema);
- extern Oid AlterOpClassNamespace_oid(Oid opclassOid, Oid newNspOid);
extern void AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId);
extern void AlterOpFamilyOwner_oid(Oid opfamilyOid, Oid newOwnerId);
- extern void AlterOpFamilyNamespace(List *name, char *access_method, const char *newschema);
- extern Oid AlterOpFamilyNamespace_oid(Oid opfamilyOid, Oid newNspOid);
extern Oid get_am_oid(const char *amname, bool missing_ok);
extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok);
extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
--- 83,90 ----
***************
*** 98,105 **** extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
/* commands/tsearchcmds.c */
extern void DefineTSParser(List *names, List *parameters);
extern void RenameTSParser(List *oldname, const char *newname);
- extern void AlterTSParserNamespace(List *name, const char *newschema);
- extern Oid AlterTSParserNamespace_oid(Oid prsId, Oid newNspOid);
extern void RemoveTSParserById(Oid prsId);
extern void DefineTSDictionary(List *names, List *parameters);
--- 92,97 ----
***************
*** 107,119 **** extern void RenameTSDictionary(List *oldname, const char *newname);
extern void RemoveTSDictionaryById(Oid dictId);
extern void AlterTSDictionary(AlterTSDictionaryStmt *stmt);
extern void AlterTSDictionaryOwner(List *name, Oid newOwnerId);
- extern void AlterTSDictionaryNamespace(List *name, const char *newschema);
- extern Oid AlterTSDictionaryNamespace_oid(Oid dictId, Oid newNspOid);
extern void DefineTSTemplate(List *names, List *parameters);
extern void RenameTSTemplate(List *oldname, const char *newname);
- extern void AlterTSTemplateNamespace(List *name, const char *newschema);
- extern Oid AlterTSTemplateNamespace_oid(Oid tmplId, Oid newNspOid);
extern void RemoveTSTemplateById(Oid tmplId);
extern void DefineTSConfiguration(List *names, List *parameters);
--- 99,107 ----
***************
*** 121,128 **** extern void RenameTSConfiguration(List *oldname, const char *newname);
extern void RemoveTSConfigurationById(Oid cfgId);
extern void AlterTSConfiguration(AlterTSConfigurationStmt *stmt);
extern void AlterTSConfigurationOwner(List *name, Oid newOwnerId);
- extern void AlterTSConfigurationNamespace(List *name, const char *newschema);
- extern Oid AlterTSConfigurationNamespace_oid(Oid cfgId, Oid newNspOid);
extern text *serialize_deflist(List *deflist);
extern List *deserialize_deflist(Datum txt);
--- 109,114 ----
*** a/src/include/nodes/parsenodes.h
--- b/src/include/nodes/parsenodes.h
***************
*** 2168,2174 **** typedef struct AlterObjectSchemaStmt
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 *newschema; /* the new schema */
bool missing_ok; /* skip error if missing? */
} AlterObjectSchemaStmt;
--- 2168,2173 ----