Re: docs: psql and variable interpolation - Mailing list pgsql-docs

From Bruce Momjian
Subject Re: docs: psql and variable interpolation
Date
Msg-id 20200721010536.GA16503@momjian.us
Whole thread Raw
In response to Re: docs: psql and variable interpolation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-docs
On Wed, Jul 15, 2020 at 11:49:44AM -0400, Tom Lane wrote:
> Philippe Beaudoin <philippe.beaudoin@dalibo.com> writes:
> > Le 13/07/2020 à 17:45, David G. Johnston a écrit :
> >> If it is only \copy that is an exception I’d rather just say (except 
> >> \copy} and not have the user meticulously read each item for the 
> >> single exception.  This extends to if there are a few.
> 
> > As far as I know, the \! metacommand is another exception. But I don't 
> > know if there are some others.
> 
> Looking at the psql source code, the commands that use OT_WHOLE_LINE
> argument parsing are
> 
> \copy
> \ef, \ev
> \sf, \sv
> \help
> \!

FYI, the way I got around \! not interpolating psql variables is to use
\setenv and then reference the variable in \!, e.g.:

    test=> \setenv x y
    test=> \! echo $x
    y

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee




pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: initdb - creating clusters
Next
From: Daniel Gustafsson
Date:
Subject: Re: initdb - creating clusters