From: Wim Bertels <wim.bertels@ucll.be>
To: pgsql-general@lists.postgresql.org
Subject: \set \e and newline
Date: Thu, 24 Feb 2022 18:16:48 +0100
Message-ID: <75f2f22ccefef9ae79e550a660083b3fe6be038b.camel@ucll.be> (raw)
Hello,
a quick question about
https://www.postgresql.org/docs/current/app-psql.html
and the \set option
it seems that \set does not interpret an 'enter' interactively the same
as an 'enter' in a short script made with \e
###
* case 1:
postgres=# \set x 1
postgres=# select :x;
?column?
----------
1
###
###
* case 2:
postgres=# \e
-- enter the following the editor (the same code as above)
\set x 1
select :x;
-- save and quit
postgres=#
-- no output
-- curiosly: again \e
postgres=#\e
-- shows select 1; in the editor in v14
-- shows nothing in the editor in v13 (or recursive the content being
cut off)
###
###
variation of case 2:
postgres=# \e
-- enter the following the editor (the same code as above)
\set x 1
select :x;
-- save and quit
postgres=# select :x;
select1select1
----------------
1
###
Doing the same thing with \i instead of \e does behave like i would
expect, ie the same as case 1.
This is referred to as meta-commands in de manual which are to be
affected when using \e, but \g instead of ; seems to work (while it
should be the same?)
###
variation of case 2 using \g instead of ; :
postgres=# \e
-- enter the following the editor (the same code as above)
\set x 1
select :x \g
-- save and quit
?column?
----------
1
(1 row)
postgres=#
###
--
mvg,
Wim
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: wim.bertels@ucll.be
Subject: Re: \set \e and newline
In-Reply-To: <75f2f22ccefef9ae79e550a660083b3fe6be038b.camel@ucll.be>
References: <75f2f22ccefef9ae79e550a660083b3fe6be038b.camel@ucll.be>
* 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