|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-04-08 02:58 UTC] jasen at treshna dot com
[2013-06-01 21:50 UTC] mbeccati@php.net
-Summary: pg_convert barfs on enum columns
+Summary: pg_convert enum type support
-Assigned To:
+Assigned To: mbeccati
[2013-06-02 04:35 UTC] mbeccati@php.net
[2013-06-02 04:35 UTC] mbeccati@php.net
-Status: Assigned
+Status: Closed
[2014-10-07 23:19 UTC] stas@php.net
[2014-10-07 23:30 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
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.