1--TEST--
2PostgreSQL pg_meta_data() - basic test using schema
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php include("skipif.inc"); ?>
7--FILE--
8<?php
9
10include('config.inc');
11
12$conn = pg_connect($conn_str);
13
14pg_query($conn, 'CREATE SCHEMA phptests');
15
16pg_query($conn, 'CREATE TABLE phptests.foo (id INT, id2 INT)');
17
18pg_query($conn, 'CREATE TABLE foo (id INT, id3 INT)');
19
20
21var_dump(pg_meta_data($conn, 'foo'));
22var_dump(pg_meta_data($conn, 'phptests.foo'));
23var_dump(pg_meta_data($conn, 'phptests.foo', TRUE));
24
25
26pg_query($conn, 'DROP TABLE foo');
27pg_query($conn, 'DROP TABLE phptests.foo');
28pg_query($conn, 'DROP SCHEMA phptests');
29
30?>
31--EXPECT--
32array(2) {
33  ["id"]=>
34  array(7) {
35    ["num"]=>
36    int(1)
37    ["type"]=>
38    string(4) "int4"
39    ["len"]=>
40    int(4)
41    ["not null"]=>
42    bool(false)
43    ["has default"]=>
44    bool(false)
45    ["array dims"]=>
46    int(0)
47    ["is enum"]=>
48    bool(false)
49  }
50  ["id3"]=>
51  array(7) {
52    ["num"]=>
53    int(2)
54    ["type"]=>
55    string(4) "int4"
56    ["len"]=>
57    int(4)
58    ["not null"]=>
59    bool(false)
60    ["has default"]=>
61    bool(false)
62    ["array dims"]=>
63    int(0)
64    ["is enum"]=>
65    bool(false)
66  }
67}
68array(2) {
69  ["id"]=>
70  array(7) {
71    ["num"]=>
72    int(1)
73    ["type"]=>
74    string(4) "int4"
75    ["len"]=>
76    int(4)
77    ["not null"]=>
78    bool(false)
79    ["has default"]=>
80    bool(false)
81    ["array dims"]=>
82    int(0)
83    ["is enum"]=>
84    bool(false)
85  }
86  ["id2"]=>
87  array(7) {
88    ["num"]=>
89    int(2)
90    ["type"]=>
91    string(4) "int4"
92    ["len"]=>
93    int(4)
94    ["not null"]=>
95    bool(false)
96    ["has default"]=>
97    bool(false)
98    ["array dims"]=>
99    int(0)
100    ["is enum"]=>
101    bool(false)
102  }
103}
104array(2) {
105  ["id"]=>
106  array(11) {
107    ["num"]=>
108    int(1)
109    ["type"]=>
110    string(4) "int4"
111    ["len"]=>
112    int(4)
113    ["not null"]=>
114    bool(false)
115    ["has default"]=>
116    bool(false)
117    ["array dims"]=>
118    int(0)
119    ["is enum"]=>
120    bool(false)
121    ["is base"]=>
122    bool(true)
123    ["is composite"]=>
124    bool(false)
125    ["is pseudo"]=>
126    bool(false)
127    ["description"]=>
128    string(0) ""
129  }
130  ["id2"]=>
131  array(11) {
132    ["num"]=>
133    int(2)
134    ["type"]=>
135    string(4) "int4"
136    ["len"]=>
137    int(4)
138    ["not null"]=>
139    bool(false)
140    ["has default"]=>
141    bool(false)
142    ["array dims"]=>
143    int(0)
144    ["is enum"]=>
145    bool(false)
146    ["is base"]=>
147    bool(true)
148    ["is composite"]=>
149    bool(false)
150    ["is pseudo"]=>
151    bool(false)
152    ["description"]=>
153    string(0) ""
154  }
155}
156