Re: Syntax error when combining --set and --command has me stumped

From: Gianni Ceccarelli <dakkar(at)thenautilus(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Syntax error when combining --set and --command has me stumped
Date: 2022-07-29 09:05:18
Message-ID: 20220729100518.6a8f819e@nautilus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

--
Dakkar - <Mobilis in mobile>
GPG public key fingerprint = A071 E618 DD2C 5901 9574
6FE2 40EA 9883 7519 3F88
key id = 0x75193F88

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lahnov, Igor 2022-07-29 15:01:44 Unable to start replica after failover
Previous Message Pavel Stehule 2022-07-29 04:25:11 Re: « The PL/pgSQL interpreter parses the function's source text and produces an internal binary instruction tree... »