From: | Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Extensions versus pg_upgrade |
Date: | 2011-02-08 22:07:11 |
Message-ID: | m2ipwumb8w.fsf@2ndQuadrant.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> OK, that seems like an equally reasonable syntax; although doing it the
> way I was thinking might have less of a code and documentation footprint
> (I was vaguely imagining that it could share most of the COMMENT
> infrastructure --- but haven't looked yet). In any case it seems like
> this is a good piece to do next, since the required functionality is
> clear and it's essential for more than one reason.
Well the code footprint is quite small already. When the grammar change
and the alter.c addition is in, it boils down to:
/*
* ALTER OBJECT SET EXTENSION
*
* This form allows for upgrading from previous PostgreSQL version to one
* supporting extensions, or to upgrade user objects to get to use the
* extension infrastructure.
*
* All we have to do is record an INTERNAL dependency between the selected
* object and the extension, which must of course already exist.
*/
void
AlterObjectExtension(const char *extname,
Oid classId, Oid objectId, Oid objectSubId)
{
ObjectAddress *extension, *object;
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to SET EXTENSION"))));
extension = (ObjectAddress *)palloc(sizeof(ObjectAddress));
extension->classId = ExtensionRelationId;
extension->objectId = get_extension_oid(extname, false);
extension->objectSubId = 0;
object = (ObjectAddress *)palloc(sizeof(ObjectAddress));
object->classId = classId;
object->objectId = objectId;
object->objectSubId = objectSubId;
recordDependencyOn(object, extension, DEPENDENCY_INTERNAL);
return;
}
Of course it needs some changes now, but well… I guess you'll be done
with that before I get to rebase my patch, I can only target tomorrow
now.
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
From | Date | Subject | |
---|---|---|---|
Next Message | Thom Brown | 2011-02-08 22:17:59 | Re: Per-column collation, the finale |
Previous Message | Kevin Grittner | 2011-02-08 22:04:39 | Re: SSI patch version 14 |