Edit report at https://bugs.php.net/bug.php?id=64609&edit=1

 ID:                 64609
 Updated by:         mbecc...@php.net
 Reported by:        jasen at treshna dot com
 Summary:            pg_convert enum type support
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            PostgreSQL related
 Operating System:   linux
 PHP Version:        5.4.13
 Assigned To:        mbeccati
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of mbeccati
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=25aae37229a439109c020150d0f496ef4a237ecd
Log: Fixed bug #64609 (pg_convert enum type support)


Previous Comments:
------------------------------------------------------------------------
[2013-04-08 02:58:51] jasen at treshna dot com

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

------------------------------------------------------------------------
[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

Reply via email to