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

2022-08-02 Thread Ron
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

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

2022-08-02 Thread Gianni Ceccarelli
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? │ ├─

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

2022-07-28 Thread Adrian Klaver
On 7/28/22 12:40, Ron wrote: $ alias psql12 alias psql12='/usr/lib/postgresql/12/bin/psql -p5433' This works ask expected: $ psql12 --set num=42 -ac "\echo :num" echo :num 42 And so does this: $ psql12 --set num=42 psql (12.11 (Ubuntu 12.11-1.pgdg18.04+1)) Type "help" for help. postgres=# s

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

2022-07-28 Thread Ron
On 7/28/22 14:47, David G. Johnston wrote: On Thu, Jul 28, 2022 at 12:40 PM Ron wrote: What secret sauce am I missing to get this to work? Given that the documentation says: "command must be either a command string that is completely parsable by the server (i.e., it contains no psql-spe

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

2022-07-28 Thread David G. Johnston
On Thu, Jul 28, 2022 at 12:40 PM Ron wrote: > What secret sauce am I missing to get this to work? > Given that the documentation says: "command must be either a command string that is completely parsable by the server (i.e., it contains no psql-specific features), or a single backslash command.

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

2022-07-28 Thread Ron
$ alias psql12 alias psql12='/usr/lib/postgresql/12/bin/psql -p5433' This works ask expected: $ psql12 --set num=42 -ac "\echo :num" echo :num 42 And so does this: $ psql12 --set num=42 psql (12.11 (Ubuntu 12.11-1.pgdg18.04+1)) Type "help" for help. postgres=# select :num;  ?column? ---