Re: BUG #18061: The psql -v variable option does not work for the -c command option - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #18061: The psql -v variable option does not work for the -c command option
Date
Msg-id CAKFQuwag6FeVC7fPO=cTGt_iOTy7rnum48cgHCn0p83xr+MLeA@mail.gmail.com
Whole thread Raw
In response to BUG #18061: The psql -v variable option does not work for the -c command option  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #18061: The psql -v variable option does not work for the -c command option  (Robert Greene <RobertMcCollisterGreene@hotmail.com>)
List pgsql-bugs
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.

pgsql-bugs by date:

Previous
From: ocean_li_996
Date:
Subject: Re:RE: BUG #18055: logical decoding core on AllocateSnapshotBuilder()
Next
From: James Inform
Date:
Subject: Re: BUG #18060: Left joining rows using random() function in join condition doesn't work as expected.