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