Re: pg_execute_from_file review

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>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, Joshua Tolley <eggyknap(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_execute_from_file review
Date: 2010-12-08 09:17:25
Message-ID: 87r5ds1v4q.fsf@hi-media-techno.com
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:
> Er ... what good is that? A non-relocatable extension doesn't *need*
> any such substitution, because it knows perfectly well what schema it's
> putting its stuff into. Only the relocatable case has use for it. So
> you might as well drop the substitution mechanism entirely.

Funnily enough, I see it the exact opposite way.

relocatable is true

A relocatable extension installs all its object into the first
schema of the search_path. As an extension's script author, you have
to make sure you're not schema qualifying any object that you
create.

Note that contrib/ is working this way but forcing the search_path
first entry into being "public".

relocatable is false

An extension that needs to know where some of its objects are
installed is not relocatable. As the user won't be able to change
the schema where the extensions gets installed, he's given the
possibility to specify the schema at installation time. The
extension installation script is then required to use the
@extschema@ placeholer as the schema to work with. That will
typically mean the script's first line is:

SET search_path TO @extschema@;

Then you can also CREATE FUNCTION … SET search_path TO @extschema@
for security reasons.

With that support in, the CREATE EXTENSION foo WITH SCHEMA bar could
simply run the ALTER EXTENSION foo SET SCHEMA bar internally, so that's
not a burden for the user. So that simple things are simple both for the
extension's author and the users, but complex things still possible and
supported here.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2010-12-08 09:19:25 Re: Review: Extensions Patch
Previous Message Dmitriy Igrishin 2010-12-08 08:51:05 Re: Feature request - CREATE TYPE ... WITH OID = oid_number.