From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephen Frost <sfrost@snowman.net>
Cc: John McKown <john.archie.mckown@gmail.com>
Cc: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Enhancement to psql command, feedback.
Date: Wed, 09 May 2018 10:30:06 -0400
Message-ID: <1755.1525876206@sss.pgh.pa.us> (raw)
In-Reply-To: <20180509135237.GB27724@tamriel.snowman.net>
References: <CAAJSdji027Pjd2QN-t5HP=sB_YgHP=X-SGbUaXy8A+mUPg_buw@mail.gmail.com>
<090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com>
<CAAJSdjharezyXFWKDrW=uiwG6EWLYes_Z19CNUimf=qGmq2A2g@mail.gmail.com>
<20180509135237.GB27724@tamriel.snowman.net>
Stephen Frost <sfrost@snowman.net> writes:
> Greetings,
> * John McKown (john.archie.mckown@gmail.com) wrote:
>> Again, this is just a discussion point. And I'm quite willing to admit
>> defeat if most people don't think that it is worth the effort.
> For my 2c, at least, I do think it'd be kind of neat to have, but we'd
> need a fool-proof way to realize that's how we're being called and,
> ideally, that would be something we could detect without having to have
> special flags for psql which anyone writing such a script would have to
> be aware of.
> Do you know if there's a way to detect that we're being called this
> way..?
Actually, I'd say that's exactly what *not* to do. It's generally
important that a script act the same whether or not it was invoked
with a shortcut. For instance, just because you had one of these
magic lines at the top, you'd not want it to not work if called
via \include.
So my take on it is that this is a request to ignore the first line
if it starts with "#!" (and yes, I'd insist on checking both characters).
I do not see that as noticeably more dangerous than the existing kluge
to ignore a UTF BOM character at the start of the file.
The concerns about whether psql would get invoked with a desirable
set of options if you tried to do this seem more worrisome, but if
that does work out usefully, I think this is a reasonable proposal.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, sfrost@snowman.net, john.archie.mckown@gmail.com, ronljohnsonjr@gmail.com
Subject: Re: Enhancement to psql command, feedback.
In-Reply-To: <1755.1525876206@sss.pgh.pa.us>
References: <CAAJSdji027Pjd2QN-t5HP=sB_YgHP=X-SGbUaXy8A+mUPg_buw@mail.gmail.com> <090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com> <CAAJSdjharezyXFWKDrW=uiwG6EWLYes_Z19CNUimf=qGmq2A2g@mail.gmail.com> <20180509135237.GB27724@tamriel.snowman.net> <1755.1525876206@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox