Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hY70l-0008I1-Vm for pgsql-general@arkaria.postgresql.org; Tue, 04 Jun 2019 10:49:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hY70k-0005UP-OY for pgsql-general@arkaria.postgresql.org; Tue, 04 Jun 2019 10:49:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hY70k-0005UH-0R for pgsql-general@lists.postgresql.org; Tue, 04 Jun 2019 10:49:46 +0000 Received: from mail.wordtothewise.com ([104.225.223.158]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hY70g-0005HN-LN for pgsql-general@lists.postgresql.org; Tue, 04 Jun 2019 10:49:44 +0000 Received: from [10.214.135.128] (unknown [217.173.105.122]) by mail.wordtothewise.com (Postfix) with ESMTPSA id 56F6F9F146 for ; Tue, 4 Jun 2019 03:49:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wordtothewise.com; s=aardvark; t=1559645381; bh=3dGrh8G2rtmErXPn+uM/NMVfIIlIh1qxVWAzJ89UGyY=; h=From:Subject:Date:References:To:In-Reply-To:From; b=QHYyp+dQ4Vp7JZ+Lr9QkzK++vvoMwLDU6UoR265XGJyVSPR5jnUyCl5nU9eVLohS0 BBgO3Iw2FnySEA00Gvppahh3nHR4JQqqa8/Nj3SPvvbzmH1DzTEHFPUolZwu9zijF4 WEgVL5ntBc2wk32FrHtV/jLwAHqsycWH403UeZXY= From: Steve Atkins Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: Research on ?? operators Date: Tue, 4 Jun 2019 11:49:36 +0100 References: <4b588eb1-a3af-3e25-c1f1-16fb93e602e3@beccati.com> To: PG mailing List In-Reply-To: <4b588eb1-a3af-3e25-c1f1-16fb93e602e3@beccati.com> Message-Id: X-Mailer: Apple Mail (2.3445.104.8) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Jun 4, 2019, at 10:00 AM, Matteo Beccati wrote: >=20 > Hello generals, >=20 > I'm trying to resurrect a change to the PHP PDO driver to allow using > the "?" json operator (and other operators containing a question = mark), > without it being interpreted as a placeholder for a query argument. In > order to do so, like Hibernate, I went for the double "??" escaping: >=20 > https://wiki.php.net/rfc/pdo_escape_placeholders >=20 > One question that I'm supposed to answer now is: is there any known > usage in the wild of some custom "??" operator that would require = funny > escaping like "????"? I don't know of one today, but that doesn't mean there isn't or won't be tomorrow. > I've tried to search pgxn but couldn't find any match, so I thought it > was worth to try and ask here. Doubling "?" to "??" isn't an obvious, intuitive way to do that, at = least to me. Maybe it would be to people coming from Java. Perl's DBD::Pg deals with it in two ways. One is to allow escaping the ? with a backslash - so "?" is a placeholder, while "\?" is passed = as "?" to the database. That's more consistent with other languages, and I think you're far less likely to ever see a backslash in a custom = operator than "??". The other is that it supports the postgresql standard placeholders - $1, $2 etc. - which avoid the issue and are more flexible. It also has a = configuration option to completely ignore "?" in queries, so "$1" is a placeholder and = "?" is passed through to the database. (Though I like the ":foo" or "@foo" style named placeholders best) Cheers, Steve