1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Add more ALTER <object> .. SET SCHEMA commands.

This adds support for changing the schema of a conversion, operator,
operator class, operator family, text search configuration, text search
dictionary, text search parser, or text search template.

Dimitri Fontaine, with assorted corrections and other kibitzing.
This commit is contained in:
Robert Haas
2010-11-26 17:27:23 -05:00
parent 1d9a0abec1
commit 55109313f9
21 changed files with 620 additions and 13 deletions

View File

@ -19,7 +19,9 @@
#include "catalog/indexing.h"
#include "catalog/pg_conversion.h"
#include "catalog/pg_conversion_fn.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_type.h"
#include "commands/alter.h"
#include "commands/conversioncmds.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
@ -326,3 +328,29 @@ 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, ConversionRelationId, convOid, nspOid,
Anum_pg_conversion_conname,
Anum_pg_conversion_connamespace,
Anum_pg_conversion_conowner,
ACL_KIND_CONVERSION,
false);
heap_close(rel, NoLock);
}