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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: 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 13:34:51
Message-ID: CA+TgmoaNBwENDdj_+Gv17cQxzT89f0nQX0YkB-y1L4hkNL28_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 4:42 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>> 9.1 has been out for only a couple of months, and we've seen a lot of people
>> trying to do that already. In hindsight, we probably should've chosen a
>> different filename extension for those files, to make it clear that you
>> can't just run them in psql. It's too late for that, but a comment at the
>> top of the .sql files would be good:
>>
>> --- a/contrib/intarray/intarray--1.0.sql
>> +++ b/contrib/intarray/intarray--1.0.sql
>> @@ -1,4 +1,8 @@
>> -/* contrib/intarray/intarray--1.0.sql */
>> +/*
>> + * contrib/intarray/intarray--1.0.sql
>> + *
>> + * Script file to be run by CREATE EXTENSION.
>> + */
>>
>>  --
>>  -- Create the user-defined type for the 1-D integer arrays (_int4)
>>
>> The people trying to run these files with psql look inside the file when
>> they get the error, so mentioning "CREATE EXTENSION" should give a hint on
>> what to do.
>
> Hmm. is there some way that we could make it do something that would
> affect only psql? I guess not, because any kind of \-command would
> actually break the CREATE EXTENSION running of the script, right?
>
> But it would be useful to be able to inject something there that psql
> would notice but the backend would ignore...

We could do that, but I think Heikki's idea of adding a comment would
help a lot. When people try to run the file through psql and it fails
due to the MODULE_PATHNAME stuff, the next thing they're probably
going to do is look at the file contents. If they see something there
telling them to use CREATE EXTENSION, that will help.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Laurian Vostinar 2011-10-12 14:03:41 BUG #6253: JDBC driver: getIndexInfo() returns quotes around quoted column names
Previous Message Andrew Dunstan 2011-10-12 13:13:20 Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-10-12 13:52:09 Re: COUNT(*) and index-only scans
Previous Message Robert Haas 2011-10-12 13:32:58 Re: COUNT(*) and index-only scans