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

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME
Дата
Msg-id CA+TgmoaNBwENDdj_+Gv17cQxzT89f0nQX0YkB-y1L4hkNL28_A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME
Список pgsql-hackers
On Wed, Oct 12, 2011 at 4:42 AM, Magnus Hagander <magnus@hagander.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: COUNT(*) and index-only scans
Следующее
От: Tom Lane
Дата:
Сообщение: Re: COUNT(*) and index-only scans