Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGQ6k-0001aL-65 for pgsql-general@arkaria.postgresql.org; Wed, 09 May 2018 14:30:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGQ6j-000809-1I for pgsql-general@arkaria.postgresql.org; Wed, 09 May 2018 14:30:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGQ6i-0007zv-Pw for pgsql-general@lists.postgresql.org; Wed, 09 May 2018 14:30:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGQ6b-0004ik-RO for pgsql-general@lists.postgresql.org; Wed, 09 May 2018 14:30:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w49EU6pf001756; Wed, 9 May 2018 10:30:06 -0400 From: Tom Lane To: Stephen Frost cc: John McKown , Ron , pgsql-general@lists.postgresql.org Subject: Re: Enhancement to psql command, feedback. In-reply-to: <20180509135237.GB27724@tamriel.snowman.net> References: <090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com> <20180509135237.GB27724@tamriel.snowman.net> Comments: In-reply-to Stephen Frost message dated "Wed, 09 May 2018 09:52:37 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1754.1525876206.1@sss.pgh.pa.us> Date: Wed, 09 May 2018 10:30:06 -0400 Message-ID: <1755.1525876206@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Stephen Frost 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