I’ve built a large multi-row insert query of 10,000 rows at 8 fields, meaning I’m passing 90,000 values to pg_query_params as the data array.
I’m getting this error back:
Warning: pg_query_params(): Query failed: ERROR: bind message
supplies 24464 parameters, but prepared statement “” requires 90000 in
class.postgresql.php on line 57
I’ve double checked the SQL and data array, there’s definitely 90,000 values being passed but for some reason it’s only detecting the magic number of 24464. Thoughts?
The over the wire protocol used by postgres indicates that the number of parameters used is passed as a signed 2 byte integer, which 90000 obviously does not fit into.
It looks like the php driver just ignores what won’t fit into the 2 byte integer – 90000 is 0x015f90, if you just take the low 2 bytes of that then you get 0x5f90 which is 24464. Break your insert into smaller batches and you should be ok