php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76012 "Invalid parameter number" error for simple query without placeholder
Submitted: 2018-02-26 16:23 UTC Modified: -
From: young dot inbox at gmail dot com Assigned:
Status: Open Package: PDO PgSQL
PHP Version: 7.2.2 OS: Ubuntu 14 LTS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: young dot inbox at gmail dot com
New email:
PHP Version: OS:

 

 [2018-02-26 16:23 UTC] young dot inbox at gmail dot com
Description:
------------
The simple query like

SELECT attribute7
FROM spot2d.client_tt
WHERE
attribute7 IN (list of values)

which doesn't not contain any placeholders give error 

PDO::query(): SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters

While PostgreSQL run this query without any errors


root@spot2dtest:/home/young# psql -h pgdev.spot2d.com -U dev ddc_scj < 2.sql 
Password for user dev: 
 attribute7 
------------
(0 rows)


If you will remove 10-20 values from any place of the list or some symbols (like ? in the middle of string) - it works

all strings quoted with PDO::quote

table content doesn't matter and it can even no exist

Here is the 2.sql file:
https://www.dropbox.com/s/v9lqzk8ht2de5x5/2.sql?dl=0

i wasn't able to reduce size of the file - if you remove 10+ values from beginning or end of list it works

Test script:
---------------
<?php

$dbh = new PDO('pgsql:host=pgdev.spot2d.com;dbname=ddc_scj', 'login_here', 'pass_here');

$sql = file_get_contents("2.sql");
$dbh->query($sql);


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed May 22 12:01:27 2019 UTC