Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctyFr-00047q-2E for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Mar 2017 15:14:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ctyFq-0003b1-Gd for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Mar 2017 15:14:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ctyEL-0000wN-AP for pgsql-hackers@postgresql.org; Fri, 31 Mar 2017 15:12:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ctyEI-0001Zo-VP for pgsql-hackers@postgresql.org; Fri, 31 Mar 2017 15:12:48 +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 v2VFChmG002902; Fri, 31 Mar 2017 11:12:43 -0400 From: Tom Lane To: Corey Huinker cc: pgsql-hackers@postgresql.org Subject: Re: Variable substitution in psql backtick expansion In-reply-to: References: <9561.1490895211@sss.pgh.pa.us> Comments: In-reply-to Corey Huinker message dated "Fri, 31 Mar 2017 07:50:44 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2900.1490973163.1@sss.pgh.pa.us> Date: Fri, 31 Mar 2017 11:12:43 -0400 Message-ID: <2901.1490973163@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Corey Huinker writes: > On Thu, Mar 30, 2017 at 1:33 PM, Tom Lane wrote: >> single-quoted according to Unix shell conventions. (So the >> processing would be a bit different from what it is for the >> same notation in SQL contexts.) > Any reason we wouldn't do :"VARIABLE" as well? Well, what would that mean exactly? The charter of :'FOO', I think, is to get the string value through shell parsing unscathed. I'm a lot less clear on what :"FOO" ought to do. If it has any use then I'd imagine that that includes allowing $shell_variable references in the string to become expanded. But then you have a situation where some shell special characters in the string are supposed to take effect but others presumably still aren't. Figuring out the exact semantics would take some specific use-cases, and more time than I really have available right now. In short, that's something I thought was best left as a later refinement, rather than doing a rush job we might regret. > People might expect it given > its use elsewhere, and it would make possible things like > SELECT '$HOME/lamentable application name dir/bin/myprog' as myprog \gset > `:"myprog" arg1 arg2` You could get about 80% of the way there with `":myprog" arg1 arg2`, since backtick processing doesn't have any rule that would prevent :myprog from being expanded inside shell double quotes. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers