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

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Petition: Treat #!... shebangs as comments
Date: 2014-07-18 21:12:33
Message-ID: CAHyXU0wqYuyT36gFkkrzuZ+6cDhK7CVr3b8NcSAtuBvombdVSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 18, 2014 at 3:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
>> While I agree with the sentiment unless someone can present a reason why
>> allowing and then ignoring a she-bang is a terrible idea then this seems
>> like a case for letting end-users decide what is best for themselves. The
>> issue then is that apparently this isn't exactly high on anyone's list of
>> ToDo items so unless the OP or one of the +1 people are willing to supply a
>> patch the odds that it gets done decreases quite quickly.
>
> 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.)
>
> The proposal seems a bit reminiscent of the requests we've had for psql
> to ignore a UTF8 byte-order mark (BOM) at the start of an input file.
> The details are considerably different of course, but anyone who wants
> to push this idea should probably read the archives to see why that idea
> still hasn't made it in.

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

OTOH (recalling the BOM discussion), the situation with stdin is
hopeless -- only psql -f or \i could strip out the shebang. And
herein lies the problem: there's no easy way to pass multiple scripts
to single psql invocation except by abusing stdin which in turn
prevents psql from knowing what the file boundaries are. So scripts
written to be run this way are kind of limited in how they could be
used. I still think it's a neat idea though.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-07-18 22:23:23 Re: Petition: Treat #!... shebangs as comments
Previous Message Tom Lane 2014-07-18 20:53:39 Re: Petition: Treat #!... shebangs as comments