Re: docs: psql and variable interpolation

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Philippe Beaudoin <philippe(dot)beaudoin(at)dalibo(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: docs: psql and variable interpolation
Date: 2020-07-21 01:05:36
Message-ID: 20200721010536.GA16503@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Wed, Jul 15, 2020 at 11:49:44AM -0400, Tom Lane wrote:
> Philippe Beaudoin <philippe(dot)beaudoin(at)dalibo(dot)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(at)momjian(dot)us> https://momjian.us
EnterpriseDB https://enterprisedb.com

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

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Daniel Gustafsson 2020-07-21 08:40:59 Re: initdb - creating clusters
Previous Message Bruce Momjian 2020-07-21 00:25:03 Re: initdb - creating clusters