pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Syntax error when combining --set and --command has me stumped
Date: Tue, 2 Aug 2022 08:07:44 -0500
Message-ID: <2bc84dca-4740-f6ba-f1a2-62751d6da75e@gmail.com> (raw)
In-Reply-To: <20220729100518.6a8f819e@nautilus>
References: <352ceea1-029d-726e-89b5-74be4946e67b@gmail.com>
	<CAKFQuwbV6kw2dWSMFYjm-SMjUCWhGYEwt-1-irHtrBGiEz_YhA@mail.gmail.com>
	<d0610dd5-6bec-07e8-b37f-c26327e0a155@gmail.com>
	<20220729100518.6a8f819e@nautilus>

On 7/29/22 04:05, Gianni Ceccarelli wrote:
> If you can use bash, or set up some redirections from whatever you're
> using to execute ``psql``, you can do::
>
>    $ psql somedb --set num=42 <<<'select :num'
>    Timing is on.
>    Expanded display is used automatically.
>    Line style is unicode.
>    Border style is 2.
>    ┌──────────┐
>    │ ?column? │
>    ├──────────┤
>    │       42 │
>    └──────────┘
>    (1 row)
>
>    Time: 0.517 ms
>
> or (more classically)::
>
>    echo 'select :num' | psql somedb --set num=42

Since my process uses the same variable in multiple bash statements, I 
decided to use a bash environment variable.

-- 
Angular momentum makes the world go 'round.





view thread (6+ messages)

Message-ID: <2bc84dca-4740-f6ba-f1a2-62751d6da75e@gmail.com>
Permalink:  ../2bc84dca-4740-f6ba-f1a2-62751d6da75e@gmail.com/
Also on:    postgresql.org/message-id/2bc84dca-4740-f6ba-f1a2-62751d6da75e@gmail.com

 · 

reply

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: ronljohnsonjr@gmail.com
  Subject: Re: Syntax error when combining --set and --command has me stumped
  In-Reply-To: <2bc84dca-4740-f6ba-f1a2-62751d6da75e@gmail.com>
  References: <352ceea1-029d-726e-89b5-74be4946e67b@gmail.com> <CAKFQuwbV6kw2dWSMFYjm-SMjUCWhGYEwt-1-irHtrBGiEz_YhA@mail.gmail.com> <d0610dd5-6bec-07e8-b37f-c26327e0a155@gmail.com> <20220729100518.6a8f819e@nautilus> <2bc84dca-4740-f6ba-f1a2-62751d6da75e@gmail.com>

* 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