Re: Petition: Treat #!... shebangs as comments

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Petition: Treat #!... shebangs as comments
Дата
Msg-id 11970.1405722203@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Petition: Treat #!... shebangs as comments  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
Merlin Moncure <mmoncure@gmail.com> writes:
> On Fri, Jul 18, 2014 at 3:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> It's not just that it's "not high on anyone's priority list", it's that
>> we'd want to be sure that the patch didn't break any existing use-cases
>> or make things unmaintainable.  (This isn't exactly a negligible concern
>> considering that Postgres thinks #! is a legal operator name.)

> I think the operator objection is specious -- ISTM there is no
> scenario where an operator could be legally parsed without seeing a
> keyword first.

[ pokes at it... ]  Yeah, perhaps so.  I had been thinking that it might
be possible for a SQL command to be continued across files, but the way
psql's MainLoop works, that's not the case.  If you do something like

       SELECT 42
       \i foo
       ;

whatever is read from foo is sent to the backend separately, it's not
folded into the outer file's SELECT.  So this may be a non-problem,
at least till such time as somebody wishes they could change that.

> OTOH (recalling the BOM discussion), the situation with stdin is
> hopeless -- only psql -f or \i could strip out the shebang.

Right, but the use-case for this is (I suppose)

    #! /path/to/psql -f

which according to the shell docs I'm looking at will result in
"./foo.sql other-args" turning into

    /path/to/psql -f ./foo.sql other-args

So it seems like it could work, and the complaint about needing additional
connection parameters isn't that strong either.

            regards, tom lane


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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: Petition: Treat #!... shebangs as comments
Следующее
От: Joel Avni
Дата:
Сообщение: High Disk Utilization on Master with Streaming Replication Running 9.2.4