xref: /PHP-8.4/ext/pgsql/tests/bug64609.phpt (revision c15988aa)
1--TEST--
2Bug #64609 (pg_convert enum type support)
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php
7include("inc/skipif.inc");
8skip_server_version('8.3', '<');
9?>
10--FILE--
11<?php
12error_reporting(E_ALL);
13
14include 'inc/config.inc';
15$table_name = 'table_bug64609';
16$type_name = 'type_bug64609';
17
18$db = pg_connect($conn_str);
19pg_query($db, "BEGIN");
20pg_query($db, "CREATE TYPE {$type_name} AS ENUM ('ok', 'ko')");
21pg_query($db, "CREATE TABLE {$table_name} (a {$type_name})");
22
23$fields = array('a' => 'ok');
24$converted = pg_convert($db, $table_name, $fields);
25
26pg_query($db, "ROLLBACK");
27
28var_dump($converted);
29?>
30--EXPECT--
31array(1) {
32  [""a""]=>
33  string(5) "E'ok'"
34}
35