Bug->Req #71885 [Opn]: PostgreSQL has questin mark operator. This collide with PDO placeholder
| From: | requinix@php.net | Date: | Wed, 23 Mar 2016 09:46:10 +0000 |
| Subject: | Bug->Req #71885 [Opn]: PostgreSQL has questin mark operator. This collide with PDO placeholder | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200055@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71885&edit=1
ID: 71885
Updated by: requinix@php.net
Reported by: miki at epoch dot co dot il
Summary: PostgreSQL has questin mark operator. This collide
with PDO placeholder
Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: PDO PgSQL
Operating System: NA
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Turn off emulated prepares.
Previous Comments:
------------------------------------------------------------------------
[2016-03-23 09:16:11] miki at epoch dot co dot il
Description:
------------
When I prepare the following query:
SELECT * FROM post WHERE locations ? :location;
The following warning occur:
Warning: PDO::prepare(): SQLSTATE[HY093]: Invalid parameter number: mixed named and positional
parameters in /path/file.php on line xx
The question mark is an valid PostgreSQL operator but PDO condsider it as a placeholder. - http://www.postgresql.org/docs/9.5/static/functions-json.html
I thought of several solutions:
1. Allow to disable question mark as placeholder. Leaving you with named placeholders.
2. Allow to change the placeholder char from a default value (?).
3. Teach pg driver to distinguish when it is a placeholder or an operator.
I think I favor point 2.
I also discussed it here:
http://stackoverflow.com/questions/36173440/how-to-ignore-question-mark-as-placeholder-when-using-pdo-with-postgresql
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71885&edit=1