On Thu, 2022-02-24 at 18:16 +0100, Wim Bertels wrote: > 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 Ok. > * 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 This was interpreted as if you had entered it in a single line: \set x 1 select :x So "x" is now "1select1;". > -- curiosly: again \e > > postgres=#\e > > -- shows select 1; in the editor in v14 That was the last executed SQL statement. > -- shows nothing in the editor in v13 (or recursive the content being > cut off) I don't quite understand what you mean, but the behavior of \e changed (got more sane) in v14. > 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 Now "x" is "1select1select1;;", so you are running select 1select1select1;;; Here "select1select1" is interpreted as alias, so you get that column heading. You can use "\echo :x" to see the value of a variable. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com