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

From: Robert Greene <RobertMcCollisterGreene(at)hotmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18061: The psql -v variable option does not work for the -c command option
Date: 2023-08-22 15:31:38
Message-ID: PH0PR12MB88248FA3E657FEE178DE8D16B61FA@PH0PR12MB8824.namprd12.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Rats

Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Sent: Sunday, August 20, 2023 11:58:01 AM
To: robertmccollistergreene(at)hotmail(dot)com <robertmccollistergreene(at)hotmail(dot)com>; pgsql-bugs(at)lists(dot)postgresql(dot)org <pgsql-bugs(at)lists(dot)postgresql(dot)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(at)postgresql(dot)org<mailto:noreply(at)postgresql(dot)org>> wrote:
The following bug has been logged on the website:

Bug reference: 18061
Logged by: Robert Greene
Email address: robertmccollistergreene(at)hotmail(dot)com<mailto:robertmccollistergreene(at)hotmail(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2023-08-22 18:45:58 Re: cache lookup failed dropping public schema with trgm index
Previous Message David G. Johnston 2023-08-22 13:45:30 Re: BUG #18065: An error occurred when attempting to add a column of type "vector" to a table named "vector".