From d9572c4e3b474031060189050e14ef384b94e001 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 8 Feb 2011 16:08:41 -0500 Subject: Core support for "extensions", which are packages of SQL objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the server infrastructure to support extensions. There is still one significant loose end, namely how to make it play nice with pg_upgrade, so I am not yet committing the changes that would make all the contrib modules depend on this feature. In passing, fix a disturbingly large amount of breakage in AlterObjectNamespace() and callers. Dimitri Fontaine, reviewed by Anssi Kääriäinen, Itagaki Takahiro, Tom Lane, and numerous others --- src/backend/commands/operatorcmds.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/backend/commands/operatorcmds.c') diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index 35bb76162d2..b4374a62f4f 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -477,12 +477,32 @@ AlterOperatorNamespace(List *names, List *argtypes, const char *newschema) /* get schema OID */ nspOid = LookupCreationNamespace(newschema); - AlterObjectNamespace(rel, OPEROID, OperatorRelationId, operOid, nspOid, + AlterObjectNamespace(rel, OPEROID, -1, + operOid, nspOid, Anum_pg_operator_oprname, Anum_pg_operator_oprnamespace, Anum_pg_operator_oprowner, - ACL_KIND_OPER, - false); + ACL_KIND_OPER); - heap_close(rel, NoLock); + 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; } -- cgit v1.2.3