|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64609 pg_convert enum type support
Submitted: 2013-04-08 02:21 UTC Modified: 2013-06-01 21:50 UTC
From: jasen at treshna dot com Assigned: mbeccati
Status: Closed Package: PostgreSQL related
PHP Version: 5.4.13 OS: linux
Private report: No CVE-ID:
 [2013-04-08 02:21 UTC] jasen at treshna dot com
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:
function sql_assert($c,$q)
	echo "FAILED: $q\nERROR:".pg_last_error($c)."\n";
	echo "can't initialise the test environment - giving up";
$con=pg_connect("host= 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 );");

Expected result:
some text starting with the word Array

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-08 02:58 UTC] 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-06-01 21:50 UTC]
-Summary: pg_convert barfs on enum columns +Summary: pg_convert enum type support -Assigned To: +Assigned To: mbeccati
 [2013-06-02 04:35 UTC]
Automatic comment on behalf of mbeccati
Log: Fixed bug #64609 (pg_convert enum type support)
 [2013-06-02 04:35 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 09:02:28 2014 UTC