Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, PostgreSQL <Pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME
Date: 2011-10-12 18:21:11
Message-ID: CABUevEyBKGBHmAUyyhF=3fMONXSPQ6iCMv4LG8bGYnsM87De_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Oct 12, 2011 at 19:36, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> On Wed, Oct 12, 2011 at 17:40, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> The only thing the \echo approach will cost us is a few more lines of C
>>> code in execute_extension_script(), and I think it's more than worth
>>> that given the evident scope of the problem.
>
>> +1.
>
> PFA, a sample patch for this --- I've only bothered to change one script
> file here, but will of course do the rest if there are no further
> objections.  The technique actually works even better than I expected,
> because of the seemingly nowhere documented fact that \quit in a script
> file doesn't terminate psql, only processing of the script.  So what
> I get is
>
> regression=# \i ~/postgres/share/extension/cube--1.0.sql
> Use "CREATE EXTENSION cube" to load this file.
> regression=#
>
> which is about as good as one could hope for.

Looks great to me.

I guess the failure scenario is if someone has an extension from 9.1.2
and tries to load it into 9.1.1 or earlier, in which case they will
get a syntax error or somehing when trying to run the CREATE EXTENSION
command, right? I doubt that's something worth dealing with - it's a
lot less likely to happen.

We might want to document this for other third-party extension
developers to use as a trick as well?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-10-12 18:29:17 Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME
Previous Message Tom Lane 2011-10-12 17:36:27 Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME

Browse pgsql-hackers by date

  From Date Subject
Next Message Phil Sorber 2011-10-12 18:27:51 Re: patch: move dumpUserConfig call in dumpRoles function of pg_dumpall.c
Previous Message Bruce Momjian 2011-10-12 18:10:57 Re: pg_ctl restart - behaviour based on wrong instance