ID: 37031
Updated by: [EMAIL PROTECTED]
Reported By: jeremy at jongsma dot org
-Status: Open
+Status: Wont fix
Bug Type: PostgreSQL related
-Operating System: Debian testing/unstable
+Operating System: *
-PHP Version: 5.1.2
+PHP Version: *
New Comment:
pg_query_params expects the data as binary data otherwise you could
have been using pg_convert() easily to convert your php data to
postgres data.
That said you need to convert true to t and false to f.
Instead you could be using pg_insert, which allows to do the correct
conversion automatically.
Need to figure out an easy way to get the necessary meta information to
allow pg_query_params() to do the conversion correct. Until then this
gets Won't fix status.
Previous Comments:
------------------------------------------------------------------------
[2006-04-10 16:12:03] jeremy at jongsma dot org
Description:
------------
pg_query_params seems to be converting boolean "false" parameters to an
empty string before sending the query to Postgres, resulting in the
following error:
ERROR: invalid input syntax for type boolean: ""
Reproduce code:
---------------
Create a table:
CREATE TABLE test (id serial8, flag boolean);
Execute this php script:
<?php
$conn = pg_connect('host=localhost dbname=test user=user
password=pass');
pg_query_params($conn, 'INSERT INTO test (flag) VALUES ($1)',
array(false));
?>
Expected result:
----------------
A new row should be inserted with the correct boolean field value.
Actual result:
--------------
ERROR: invalid input syntax for type boolean: ""
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37031&edit=1