pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gianni Ceccarelli <dakkar@thenautilus.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Syntax error when combining --set and --command has me stumped
Date: Fri, 29 Jul 2022 10:05:18 +0100
Message-ID: <20220729100518.6a8f819e@nautilus> (raw)
In-Reply-To: <d0610dd5-6bec-07e8-b37f-c26327e0a155@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>

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






view thread (6+ messages)  latest in thread

Message-ID: <20220729100518.6a8f819e@nautilus>
Permalink:  ../20220729100518.6a8f819e@nautilus/
Also on:    postgresql.org/message-id/20220729100518.6a8f819e@nautilus

 · 

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: dakkar@thenautilus.net
  Subject: Re: Syntax error when combining --set and --command has me stumped
  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>

* 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