|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-03-01 22:46 UTC] adambaratz@php.net
-Status: Open
+Status: Duplicate
-Package: PDO related
+Package: PDO PgSQL
[2017-03-01 22:46 UTC] adambaratz@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 07:00:01 2025 UTC |
Description: ------------ Sometimes statements for pgsql may contain operators that contain symbols '?' or '::', would be really great to have an option like Perl `pg_placeholder_dollaronly` and not to treat those symbols as placeholders. Test script: --------------- Create some_table in Postgres: CREATE TYPE some_type AS ( some_column hstore ); CREATE TABLE some_table OF some_type; <?php $dbh = new PDO("pgsql:dbname=some_database;host=some_host", 'some_user', 'some_password' ); $sth = $dbh->prepare('SELECT * FROM some_table WHERE some_column ? :some_param'); $sth->execute(array(':some_param' => 'some_criteria')); ... And right here we get of course Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters' Expected result: ---------------- For statement like SELECT * FROM some_table WHERE some_column ? :some_param would be great to be able to tell PDO not to parse '?' and ':' as placeholders in some cases