1--TEST--
2PostgreSQL pg_convert() and JSON/Array
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php
7include("skipif.inc");
8skip_server_version('9.2');
9?>
10--FILE--
11<?php
12error_reporting(E_ALL);
13
14include 'config.inc';
15
16$db = pg_connect($conn_str);
17
18$fields = array(
19    'textary'=>'{"meeting", "lunch", "training", "presentation"}',
20    'jsn'=>'{"f1":1,"f2":"foo"}',
21);
22$converted = pg_convert($db, $table_name_92, $fields);
23var_dump($converted);
24
25if (!pg_insert($db, $table_name_92, $fields)) {
26    echo "Error\n";
27} else {
28    echo "OK\n";
29}
30
31?>
32--EXPECT--
33array(2) {
34  [""textary""]=>
35  string(51) "E'{"meeting", "lunch", "training", "presentation"}'"
36  [""jsn""]=>
37  string(22) "E'{"f1":1,"f2":"foo"}'"
38}
39OK
40