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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: robertmccollistergreene(at)hotmail(dot)com, 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-20 16:58:01
Message-ID: CAKFQuwag6FeVC7fPO=cTGt_iOTy7rnum48cgHCn0p83xr+MLeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Aug 20, 2023 at 8:56 AM PG Bug reporting form <
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
> 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message James Inform 2023-08-20 17:58:29 Re: BUG #18060: Left joining rows using random() function in join condition doesn't work as expected.
Previous Message ocean_li_996 2023-08-20 16:51:30 Re:RE: BUG #18055: logical decoding core on AllocateSnapshotBuilder()