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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Aidan Van Dyk <aidan(at)highrise(dot)ca>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(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 15:15:43
Message-ID: 13733.1318432543@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Aidan Van Dyk <aidan(at)highrise(dot)ca> writes:
> On Wed, Oct 12, 2011 at 10:50 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Hmm ...
>> \echo You should use CREATE EXTENSION foo to load this file!

> Decorate them with a marker like:
> \extension <name> <version>
> And make the CREATE EXTENSION skip (or verify) it?
> It will make psql stop on the \extension command.

No, the point is not to stop or fail, it is to print out an unmistakable
user instruction. Otherwise we'll still be getting "cube.sql failed to
load for me" bug reports. So I think \echo is entirely sufficient,
and we should not rely on psql features that aren't there yet. Ideally
this should do what we want even in older psql releases. \echo has been
there at least since 7.0.

It strikes me that we could get rid of the error message clutter
I worried about before if we coded like this:

/* contrib/foo--1.0.sql */

\echo Use "CREATE EXTENSION foo" to load this file. \quit

... SQL commands here ...

The forced \quit is a bit unfriendly maybe but it will get the job done.
And again, this isn't making any assumptions about which psql version
you're using.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-10-12 15:20:21 Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME
Previous Message Heikki Linnakangas 2011-10-12 15:09:11 Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-10-12 15:18:03 Re: COUNT(*) and index-only scans
Previous Message Heikki Linnakangas 2011-10-12 15:09:11 Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME