BUG #18061: The psql -v variable option does not work for the -c command option

Started by PG Bug reporting formover 2 years ago3 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 18061
Logged by: Robert Greene
Email address: robertmccollistergreene@hotmail.com
PostgreSQL version: 15.4
Operating system: Windows, Linux
Description:

psql -v v1=1 -c "select col from table where colname=:v1;"

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: PG Bug reporting form (#1)
Re: BUG #18061: The psql -v variable option does not work for the -c command option

On Sun, Aug 20, 2023 at 8:56 AM PG Bug reporting form <
noreply@postgresql.org> wrote:

The following bug has been logged on the website:

Bug reference: 18061
Logged by: Robert Greene
Email address: robertmccollistergreene@hotmail.com
PostgreSQL version: 15.4
Operating system: Windows, Linux
Description:

psql -v v1=1 -c "select col from table where colname=:v1;"

Yes, since psql variables are not parsable by the server the following
sentence in the documentation for -c explains your observation:

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.

David J.

#3Robert Greene
RobertMcCollisterGreene@hotmail.com
In reply to: David G. Johnston (#2)
Re: BUG #18061: The psql -v variable option does not work for the -c command option

Rats

Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg&gt;
________________________________
From: David G. Johnston <david.g.johnston@gmail.com>
Sent: Sunday, August 20, 2023 11:58:01 AM
To: robertmccollistergreene@hotmail.com <robertmccollistergreene@hotmail.com>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #18061: The psql -v variable option does not work for the -c command option

On Sun, Aug 20, 2023 at 8:56 AM PG Bug reporting form <noreply@postgresql.org<mailto:noreply@postgresql.org>> wrote:
The following bug has been logged on the website:

Bug reference: 18061
Logged by: Robert Greene
Email address: robertmccollistergreene@hotmail.com<mailto:robertmccollistergreene@hotmail.com>
PostgreSQL version: 15.4
Operating system: Windows, Linux
Description:

psql -v v1=1 -c "select col from table where colname=:v1;"

Yes, since psql variables are not parsable by the server the following sentence in the documentation for -c explains your observation:

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.

David J.