Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fLqpl-0008TP-6z for pgsql-general@arkaria.postgresql.org; Thu, 24 May 2018 14:03:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fLqpk-0006ja-2j for pgsql-general@arkaria.postgresql.org; Thu, 24 May 2018 14:03:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fLqpj-0006jQ-RG for pgsql-general@lists.postgresql.org; Thu, 24 May 2018 14:03:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fLqpc-0007Uj-E9 for pgsql-general@postgresql.org; Thu, 24 May 2018 14:03:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w4OE2vvY024318; Thu, 24 May 2018 10:02:57 -0400 From: Tom Lane To: "David G. Johnston" cc: Lele Gaifax , "pgsql-general@postgresql.org" Subject: Re: Parameter placeholders, $n vs ? In-reply-to: References: <87o9h5bjhs.fsf@metapensiero.it> Comments: In-reply-to "David G. Johnston" message dated "Thu, 24 May 2018 05:17:52 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24316.1527170577.1@sss.pgh.pa.us> Date: Thu, 24 May 2018 10:02:57 -0400 Message-ID: <24317.1527170577@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > On Thursday, May 24, 2018, Lele Gaifax 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". regards, tom lane