Edit report at https://bugs.php.net/bug.php?id=64609&edit=1
ID: 64609
Comment by: jasen at treshna dot com
Reported by: jasen at treshna dot com
Summary: pg_convert barfs on enum columns
Status: Open
Type: Bug
Package: PostgreSQL related
Operating System: linux
PHP Version: 5.4.13
Block user comment: N
Private report: N
New Comment:
on looking at the source
php_pgsql_convert() in ext/pgsql/pgsql.c
It looks like this usage goes against the design principles of pg_convert and
thus pg_insert pg_delete pg_update (etc...) perhaps the documentation could be
ammended to reflect this.
other things I noticed
no support of ipv6
attempts to validate dates using regex
Previous Comments:
------------------------------------------------------------------------
[2013-04-08 02:21:09] jasen at treshna dot com
Description:
------------
pg_convert, pg_update, pg_insert
can't handle inputs that reference enum columns.
syntactically enum columns can be treated like string columns.
Test script:
---------------
<?php
function sql_assert($c,$q)
{
$r=pg_query($c,$q);
if($r)
{
pg_free_result($r);
return;
}
echo "FAILED: $q\nERROR:".pg_last_error($c)."\n";
echo "can't initialise the test environment - giving up";
die(1);
}
$con=pg_connect("host=127.0.0.1 user=test password=php5 dbname=phptest");
sql_assert($con,"drop type if exists enumtest cascade;");
sql_assert($con," create type enumtest as enum ( 'alpha', 'beta', 'gamma' );");
sql_assert($con," drop table if exists e_test;");
sql_assert($con," create table e_test( id integer, label text, num enumtest
);");
print_r(pg_convert($con,"e_test",array('id'=>11,'label'=>'fail','num'=>'gamma')));
Expected result:
----------------
some text starting with the word Array
Actual result:
--------------
nothing.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64609&edit=1