Re: Parameter placeholders, $n vs ?

From: Lele Gaifax <lele(at)metapensiero(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Parameter placeholders, $n vs ?
Date: 2018-05-24 18:58:16
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
>> On Thursday, May 24, 2018, Lele Gaifax <lele(at)metapensiero(dot)it> wrote:
>>> So the questions: is the '?' style placeholder a supported variant? and
>>> if so, should the ParamRef doc tell something about that?
>> PostgreSQL's Prepare statement doesn't accept question mark as a parameter
>> symbol, and cannot ever because it is already a valid operator symbol.
> To enlarge on that a bit:
> * PG's core parser certainly does not accept ? as a parameter symbol.
> I speculate that you fed the input through some frontend that converts
> ? to $n (JDBC, perhaps)?
> * The only thing in the core code that would print a ParamRef in any
> sort of symbolic form is _outParamRef, and it's easily seen by inspection
> to be incapable of omitting the "number" field ... not to mention that
> it doesn't emit the JSON-esque representation you're showing us. So
> that behavior must also be due to some non-core pretty-printing code you
> haven't identified to us. No idea what rules that might have for deciding
> to omit "number".

Thank you to both. As said, the tool is built on the PG 10 parser extracted as a
standalone library, that serializes the statement AST as JSON. I assumed it
didn't diverge much from what the core parser accepts.

I will clarify my doubt with libpg_query's author.

bye, lele.
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele(at)metapensiero(dot)it | -- Fortunato Depero, 1929.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paolo Crosato 2018-05-24 19:00:55 Re: Error on vacuum: xmin before relfrozenxid
Previous Message Alvaro Herrera 2018-05-24 17:08:53 Re: found xmin from before relfrozenxid on pg_catalog.pg_authid