Re: Extension Templates S03E11 - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Extension Templates S03E11
Date
Msg-id m2bo15lpe8.fsf@2ndQuadrant.fr
Whole thread Raw
In response to Re: Extension Templates S03E11  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Extension Templates S03E11  (Jeff Davis <pgsql@j-davis.com>)
Re: Extension Templates S03E11  (Jeff Davis <pgsql@j-davis.com>)
Re: Extension Templates S03E11  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:
> We already have other 'template' objects in the system and I'm not
> excited about the confusion.  This also applies to 'CreateTemplate',
> 'CreateTemplateTupleDesc', right down to 'template.h' and 'template.c'.

The current code is made to expose the notion of a template and only
implements one kind of template, for extensions. Still the
ProcessUtility hooking has been made so as to make it easy adding new
templates.

Given that I haven't seen any other template idea in the years I've been
contributing to PostgreSQL other than the FTS template, and that I'm
seeing no other candidate, I took the arbitrary decision not to open the
sources more than that to the idea of other kinds of templates.

We could of course have a 50 lines templates.c file that calls into an
extension_template.c file for the meat of the implementation if that's
prefered by the project.

Just tell me about that, it's not in the attached patch.

> Attached is a patch against v16 which fixes up a few documentation
> issues (I'm pretty sure extension templates and aggregates are
> unrelated..), and points out that there is zero documentation on these
> new catalog tables (look for 'XXX' in the patch) along with a few
> other areas which could use improvement.

I merged your patch in, rebased against master, fixed some more typos I
found, and filled in the gaps you found in the docs. Version 17 of the
patch is attached to that email, passes `make check`.

ENOTIME for building docs, will do tomorrow, I though you might
appreciate an update meanwhile (and with some luck docs still build
fine).

The other main point that will change the current code is dealing with
superusers and security concerns. Baring objections, I'm going to
implement a variation of what I did propose in the thread:

  When a superuser CREATE EXTENSION against a template that has been
  provided by a non-privileged user, automatically SET ROLE to that user
  before doing so, avoiding escalation privileges.

If that's not what the superuser intended, then it still is possible for
him to ALTER TEMPLATE FOR EXTENSION … OWNER TO himself beforehand.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: lock on object is already held
Next
From: Atri Sharma
Date:
Subject: Re: Status of FDW pushdowns