xref: /PHP-8.3/ext/pgsql/tests/01createdb.phpt (revision 1f427779)
1--TEST--
2PostgreSQL create db
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php include("skipif.inc"); ?>
7--FILE--
8<?php
9// create test table
10
11include('config.inc');
12
13$db = pg_connect($conn_str);
14if (!($q = @pg_query($db, "SELECT * FROM ".$table_name)) || !@pg_num_rows($q))
15{
16    pg_query($db,$table_def); // Create table here
17    for ($i=0; $i < $num_test_record; $i++) {
18        pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');");
19    }
20}
21else {
22    echo pg_last_error()."\n";
23}
24
25$v = pg_version($db);
26if (version_compare($v['server'], '9.2', '>=') && (!($q = @pg_query($db, "SELECT * FROM ".$table_name_92)) || !@pg_num_rows($q)))
27{
28    pg_query($db,$table_def_92); // Create table here
29}
30else {
31    echo pg_last_error()."\n";
32}
33
34// Create view here
35pg_query($db,$view_def);
36
37pg_close($db);
38
39echo "OK";
40?>
41--EXPECT--
42OK
43