From 7b507cd072babec6d0d75a88c31b418be4b9517c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Thu, 2 Nov 2023 18:44:13 +0900 Subject: [PATCH 01/17] refactor(ext/pgsql/tests): relocating configuration files --- ext/pgsql/tests/00version.phpt | 4 ++-- ext/pgsql/tests/01createdb.phpt | 4 ++-- ext/pgsql/tests/02connection.phpt | 4 ++-- ext/pgsql/tests/03sync_query.phpt | 4 ++-- ext/pgsql/tests/04async_query.phpt | 4 ++-- ext/pgsql/tests/05large_object.phpt | 4 ++-- ext/pgsql/tests/06_bug73498.phpt | 4 ++-- ext/pgsql/tests/06copy.phpt | 4 ++-- ext/pgsql/tests/06copy_2.phpt | 4 ++-- ext/pgsql/tests/07optional.phpt | 4 ++-- ext/pgsql/tests/08escape.phpt | 4 ++-- ext/pgsql/tests/09notice.phpt | 6 +++--- ext/pgsql/tests/10pg_convert.phpt | 4 ++-- ext/pgsql/tests/10pg_convert_9.phpt | 4 ++-- ext/pgsql/tests/10pg_convert_json_array.phpt | 4 ++-- ext/pgsql/tests/11pg_meta_data.phpt | 4 ++-- ext/pgsql/tests/12pg_insert.phpt | 4 ++-- ext/pgsql/tests/12pg_insert_9.phpt | 4 ++-- ext/pgsql/tests/13pg_select.phpt | 4 ++-- ext/pgsql/tests/13pg_select_9.phpt | 4 ++-- ext/pgsql/tests/14pg_update.phpt | 4 ++-- ext/pgsql/tests/14pg_update_9.phpt | 4 ++-- ext/pgsql/tests/15pg_delete.phpt | 4 ++-- ext/pgsql/tests/16pg_result_status.phpt | 4 ++-- ext/pgsql/tests/17result.phpt | 4 ++-- ext/pgsql/tests/18pg_escape_bytea_before.phpt | 4 ++-- ext/pgsql/tests/18pg_escape_bytea_esc.phpt | 4 ++-- ext/pgsql/tests/18pg_escape_bytea_hex.phpt | 4 ++-- ext/pgsql/tests/19pg_ping.phpt | 4 ++-- ext/pgsql/tests/20pg_get_pid.phpt | 4 ++-- ext/pgsql/tests/21pg_get_notify.phpt | 4 ++-- ext/pgsql/tests/22pg_fetch_object.phpt | 4 ++-- ext/pgsql/tests/23sync_query_params.phpt | 4 ++-- ext/pgsql/tests/24sync_query_prepared.phpt | 4 ++-- ext/pgsql/tests/25async_query_params.phpt | 4 ++-- ext/pgsql/tests/26async_query_prepared.phpt | 4 ++-- ext/pgsql/tests/27large_object_oid.phpt | 4 ++-- ext/pgsql/tests/28large_object_import_oid.phpt | 4 ++-- ext/pgsql/tests/29nb_async_connect.phpt | 6 +++--- ext/pgsql/tests/30nb_async_query_params.phpt | 6 +++--- ext/pgsql/tests/31nb_async_query_prepared.phpt | 6 +++--- ext/pgsql/tests/32nb_async_query.phpt | 6 +++--- ext/pgsql/tests/80_bug14383.phpt | 4 ++-- ext/pgsql/tests/80_bug24499.phpt | 4 ++-- ext/pgsql/tests/80_bug27597.phpt | 4 ++-- ext/pgsql/tests/80_bug32223.phpt | 6 +++--- ext/pgsql/tests/80_bug32223b.phpt | 6 +++--- ext/pgsql/tests/80_bug36625.phpt | 4 ++-- ext/pgsql/tests/80_bug39971.phpt | 4 ++-- ext/pgsql/tests/80_bug42783.phpt | 4 ++-- ext/pgsql/tests/98old_api.phpt | 4 ++-- ext/pgsql/tests/9999dropdb.phpt | 4 ++-- ext/pgsql/tests/bug37100.phpt | 4 ++-- ext/pgsql/tests/bug37100_9.phpt | 4 ++-- ext/pgsql/tests/bug46408.phpt | 4 ++-- ext/pgsql/tests/bug47199.phpt | 4 ++-- ext/pgsql/tests/bug60244.phpt | 4 ++-- ext/pgsql/tests/bug64609.phpt | 4 ++-- ext/pgsql/tests/bug65119.phpt | 4 ++-- ext/pgsql/tests/bug68638.phpt | 4 ++-- ext/pgsql/tests/bug71062.phpt | 4 ++-- ext/pgsql/tests/bug71998.phpt | 4 ++-- ext/pgsql/tests/bug72028.phpt | 4 ++-- ext/pgsql/tests/bug72195.phpt | 2 +- ext/pgsql/tests/bug72197.phpt | 4 ++-- ext/pgsql/tests/bug75419.phpt | 4 ++-- ext/pgsql/tests/bug76548.phpt | 4 ++-- ext/pgsql/tests/bug77047.phpt | 4 ++-- ext/pgsql/tests/bug81720.phpt | 4 ++-- ext/pgsql/tests/close_default_link.phpt | 4 ++-- ext/pgsql/tests/connect_after_close.phpt | 4 ++-- ext/pgsql/tests/connection_reuse.phpt | 4 ++-- ext/pgsql/tests/deprecated_implicit_default_link.phpt | 4 ++-- ext/pgsql/tests/gh10672.phpt | 4 ++-- ext/pgsql/tests/gh8253.phpt | 4 ++-- ext/pgsql/tests/{ => inc}/config.inc | 0 ext/pgsql/tests/{ => inc}/lcmess.inc | 0 ext/pgsql/tests/{ => inc}/nonblocking.inc | 0 ext/pgsql/tests/{ => inc}/skipif.inc | 0 ext/pgsql/tests/pg_delete_001.phpt | 4 ++-- ext/pgsql/tests/pg_insert_001.phpt | 4 ++-- ext/pgsql/tests/pg_insert_002.phpt | 4 ++-- ext/pgsql/tests/pg_meta_data_001.phpt | 4 ++-- ext/pgsql/tests/pg_pipeline_sync.phpt | 6 +++--- ext/pgsql/tests/pg_select_001.phpt | 4 ++-- ext/pgsql/tests/pg_trace.phpt | 4 ++-- ext/pgsql/tests/pg_update_001.phpt | 4 ++-- 87 files changed, 173 insertions(+), 173 deletions(-) rename ext/pgsql/tests/{ => inc}/config.inc (100%) rename ext/pgsql/tests/{ => inc}/lcmess.inc (100%) rename ext/pgsql/tests/{ => inc}/nonblocking.inc (100%) rename ext/pgsql/tests/{ => inc}/skipif.inc (100%) diff --git a/ext/pgsql/tests/00version.phpt b/ext/pgsql/tests/00version.phpt index 84cbb1b50655b..97494a451b691 100644 --- a/ext/pgsql/tests/00version.phpt +++ b/ext/pgsql/tests/00version.phpt @@ -3,12 +3,12 @@ PostgreSQL version --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- + --FILE-- --FILE-- '1234', 'str'=>'AAA', 'bin'=>'BBB'); diff --git a/ext/pgsql/tests/12pg_insert_9.phpt b/ext/pgsql/tests/12pg_insert_9.phpt index 892494fe6f0a9..32399464c77c4 100644 --- a/ext/pgsql/tests/12pg_insert_9.phpt +++ b/ext/pgsql/tests/12pg_insert_9.phpt @@ -4,14 +4,14 @@ PostgreSQL pg_insert() (9.0+) pgsql --SKIPIF-- --FILE-- ='); ?> --FILE-- '1234', 'str'=>'ABC', 'bin'=>'XYZ'); diff --git a/ext/pgsql/tests/13pg_select_9.phpt b/ext/pgsql/tests/13pg_select_9.phpt index 9246288e5c8c0..43d71dff0c291 100644 --- a/ext/pgsql/tests/13pg_select_9.phpt +++ b/ext/pgsql/tests/13pg_select_9.phpt @@ -4,14 +4,14 @@ PostgreSQL pg_select() (9.0+) pgsql --SKIPIF-- --FILE-- --FILE-- '1234', 'str'=>'ABC', 'bin'=>'XYZ'); diff --git a/ext/pgsql/tests/14pg_update_9.phpt b/ext/pgsql/tests/14pg_update_9.phpt index d34f05216ec45..bf16cb799288e 100644 --- a/ext/pgsql/tests/14pg_update_9.phpt +++ b/ext/pgsql/tests/14pg_update_9.phpt @@ -4,14 +4,14 @@ PostgreSQL pg_update() (9.0+) pgsql --SKIPIF-- --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- --FILE-- \$1;", array(100)); diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt index 92bb6ac8f6122..981792c2a8484 100644 --- a/ext/pgsql/tests/24sync_query_prepared.phpt +++ b/ext/pgsql/tests/24sync_query_prepared.phpt @@ -4,13 +4,13 @@ PostgreSQL sync prepared queries pgsql --SKIPIF-- --FILE-- --FILE-- \$1;", array(100))) { diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt index 8f0adb6cda262..72099b83d13f8 100644 --- a/ext/pgsql/tests/26async_query_prepared.phpt +++ b/ext/pgsql/tests/26async_query_prepared.phpt @@ -4,13 +4,13 @@ PostgreSQL async prepared queries pgsql --SKIPIF-- --FILE-- \$1;")) { diff --git a/ext/pgsql/tests/27large_object_oid.phpt b/ext/pgsql/tests/27large_object_oid.phpt index 4581d18a88080..1026786164dc2 100644 --- a/ext/pgsql/tests/27large_object_oid.phpt +++ b/ext/pgsql/tests/27large_object_oid.phpt @@ -4,7 +4,7 @@ PostgreSQL create large object with given oid pgsql --SKIPIF-- 0) die("skip - requires pg client >= 8.3\n"); if (version_compare("8.3", $v["server"]) > 0) die("skip - requires pg server >= 8.3\n"); @@ -12,7 +12,7 @@ if (version_compare("8.3", $v["server"]) > 0) die("skip - requires pg server >= --FILE-- 0) die("skip - requires pg client >= 8.4\n"); if (version_compare("8.4devel", $v["server"]) > 0) die("skip - requires pg server >= 8.4\n"); @@ -12,7 +12,7 @@ if (version_compare("8.4devel", $v["server"]) > 0) die("skip - requires pg serve --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- + --FILE-- + --FILE-- --FILE-- --FILE-- --FILE-- 0) pgsql --SKIPIF-- --FILE-- --FILE-- --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- --FILE-- --FILE-- "testing"]; diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/inc/config.inc similarity index 100% rename from ext/pgsql/tests/config.inc rename to ext/pgsql/tests/inc/config.inc diff --git a/ext/pgsql/tests/lcmess.inc b/ext/pgsql/tests/inc/lcmess.inc similarity index 100% rename from ext/pgsql/tests/lcmess.inc rename to ext/pgsql/tests/inc/lcmess.inc diff --git a/ext/pgsql/tests/nonblocking.inc b/ext/pgsql/tests/inc/nonblocking.inc similarity index 100% rename from ext/pgsql/tests/nonblocking.inc rename to ext/pgsql/tests/inc/nonblocking.inc diff --git a/ext/pgsql/tests/skipif.inc b/ext/pgsql/tests/inc/skipif.inc similarity index 100% rename from ext/pgsql/tests/skipif.inc rename to ext/pgsql/tests/inc/skipif.inc diff --git a/ext/pgsql/tests/pg_delete_001.phpt b/ext/pgsql/tests/pg_delete_001.phpt index abf01a6b53f6d..12ce57bd4d0ff 100644 --- a/ext/pgsql/tests/pg_delete_001.phpt +++ b/ext/pgsql/tests/pg_delete_001.phpt @@ -3,11 +3,11 @@ PostgreSQL pg_delete() - basic test using schema --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- Date: Thu, 2 Nov 2023 20:43:53 +0900 Subject: [PATCH 02/17] refactor(ext/pgsql/tests): delete table in `--CLEAN--` --- ext/pgsql/tests/06copy_2.phpt | 6 +++++- ext/pgsql/tests/80_bug24499.phpt | 9 +++++++-- ext/pgsql/tests/80_bug27597.phpt | 8 +++++++- ext/pgsql/tests/80_bug39971.phpt | 13 ++++++++----- ext/pgsql/tests/80_bug42783.phpt | 8 +++++++- ext/pgsql/tests/bug37100.phpt | 11 +++++------ ext/pgsql/tests/bug37100_9.phpt | 10 +++++++--- ext/pgsql/tests/bug47199.phpt | 10 ++++++++-- ext/pgsql/tests/bug68638.phpt | 9 ++++++++- ext/pgsql/tests/bug71062.phpt | 10 ++++++++-- ext/pgsql/tests/bug71998.phpt | 8 +++++++- ext/pgsql/tests/bug72028.phpt | 9 +++++++-- ext/pgsql/tests/bug77047.phpt | 8 +++++++- ext/pgsql/tests/gh10672.phpt | 8 +++++++- ext/pgsql/tests/gh8253.phpt | 8 +++++++- ext/pgsql/tests/pg_delete_001.phpt | 7 ++++++- ext/pgsql/tests/pg_insert_001.phpt | 7 ++++++- ext/pgsql/tests/pg_meta_data_001.phpt | 6 +++++- ext/pgsql/tests/pg_select_001.phpt | 7 ++++++- ext/pgsql/tests/pg_update_001.phpt | 7 ++++++- 20 files changed, 134 insertions(+), 35 deletions(-) diff --git a/ext/pgsql/tests/06copy_2.phpt b/ext/pgsql/tests/06copy_2.phpt index 5c528842769aa..789c943138e42 100644 --- a/ext/pgsql/tests/06copy_2.phpt +++ b/ext/pgsql/tests/06copy_2.phpt @@ -21,9 +21,13 @@ pg_put_line($db, "\\.\n"); pg_end_copy($db); var_dump(pg_fetch_all_columns(pg_query($db, 'SELECT * FROM test_copy ORDER BY 1'))); +?> +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/80_bug24499.phpt b/ext/pgsql/tests/80_bug24499.phpt index 2054d393ab202..12fe17f9910e0 100644 --- a/ext/pgsql/tests/80_bug24499.phpt +++ b/ext/pgsql/tests/80_bug24499.phpt @@ -16,8 +16,6 @@ if (!$dbh) { die ("Could not connect to the server"); } -@pg_query($dbh, "DROP SEQUENCE id_id_seq"); -@pg_query($dbh, "DROP TABLE id"); pg_query($dbh, "CREATE TABLE id (id SERIAL, t INT)"); for ($i=0; $i<4; $i++) { @@ -48,6 +46,13 @@ pg_close($dbh); echo "Done\n"; +?> +--CLEAN-- + --EXPECTF-- Array diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt index 5e87d031805bb..fa73ca0634126 100644 --- a/ext/pgsql/tests/80_bug27597.phpt +++ b/ext/pgsql/tests/80_bug27597.phpt @@ -16,7 +16,6 @@ if (!$dbh) { die ("Could not connect to the server"); } -@pg_query($dbh, "DROP TABLE id"); pg_query($dbh, "CREATE TABLE id (id INT)"); for ($i=0; $i<4; $i++) { @@ -40,6 +39,13 @@ while($row = xi_fetch_array($res)) { pg_close($dbh); +?> +--CLEAN-- + --EXPECT-- Array diff --git a/ext/pgsql/tests/80_bug39971.phpt b/ext/pgsql/tests/80_bug39971.phpt index b66c1ce5d0a3c..4564694697df1 100644 --- a/ext/pgsql/tests/80_bug39971.phpt +++ b/ext/pgsql/tests/80_bug39971.phpt @@ -11,10 +11,7 @@ require_once('inc/skipif.inc'); require_once('inc/config.inc'); -$dbh = @pg_connect($conn_str); -if (!$dbh) { - die ("Could not connect to the server"); -} +$dbh = pg_connect($conn_str); pg_query($dbh, "CREATE TABLE php_test (id SERIAL, tm timestamp NOT NULL)"); @@ -24,9 +21,15 @@ pg_insert($dbh, 'php_test', $values); $ids = array('id' => 1); pg_update($dbh, 'php_test', $values, $ids); -pg_query($dbh, "DROP TABLE php_test"); pg_close($dbh); ?> ===DONE=== +--CLEAN-- + --EXPECT-- ===DONE=== diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt index 83b7e947eef57..e401411c3b193 100644 --- a/ext/pgsql/tests/80_bug42783.phpt +++ b/ext/pgsql/tests/80_bug42783.phpt @@ -22,9 +22,15 @@ pg_insert($dbh, 'php_test', array()); var_dump(pg_fetch_assoc(pg_query($dbh, "SELECT * FROM php_test"))); -pg_query($dbh, "DROP TABLE php_test"); pg_close($dbh); ?> +--CLEAN-- + --EXPECTF-- array(2) { ["id"]=> diff --git a/ext/pgsql/tests/bug37100.phpt b/ext/pgsql/tests/bug37100.phpt index b044a65154b9a..b60603e2dd8a1 100644 --- a/ext/pgsql/tests/bug37100.phpt +++ b/ext/pgsql/tests/bug37100.phpt @@ -15,8 +15,6 @@ include 'inc/config.inc'; $db = pg_connect($conn_str); @pg_query("SET bytea_output = 'escape'"); -@pg_query('DROP TABLE test_bug'); - pg_query('CREATE TABLE test_bug (binfield byteA) ;'); pg_query("INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))"); @@ -35,12 +33,13 @@ var_dump(strlen($res)); var_dump(bin2hex($res)); pg_close($db); - +?> +--CLEAN-- + --EXPECT-- string(24) "\001\003\252\000\010\022" diff --git a/ext/pgsql/tests/bug37100_9.phpt b/ext/pgsql/tests/bug37100_9.phpt index 8ba42f014f6cf..3e17e57ab226d 100644 --- a/ext/pgsql/tests/bug37100_9.phpt +++ b/ext/pgsql/tests/bug37100_9.phpt @@ -14,8 +14,6 @@ include 'inc/config.inc'; $db = pg_connect($conn_str); -@pg_query($db, 'DROP TABLE test_bug'); - pg_query($db, 'CREATE TABLE test_bug (binfield byteA) ;'); pg_query($db, "INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))"); @@ -36,10 +34,16 @@ var_dump(bin2hex($res)); pg_close($db); $db = pg_connect($conn_str); -pg_query($db, 'DROP TABLE test_bug'); pg_close($db); +?> +--CLEAN-- + --EXPECT-- string(14) "\x0103aa000812" diff --git a/ext/pgsql/tests/bug47199.phpt b/ext/pgsql/tests/bug47199.phpt index 6ed31c67ebf30..a4a03b19c437b 100644 --- a/ext/pgsql/tests/bug47199.phpt +++ b/ext/pgsql/tests/bug47199.phpt @@ -13,7 +13,6 @@ require_once('inc/config.inc'); $dbh = pg_connect($conn_str); $tbl_name = 'test_47199'; -@pg_query($dbh, "DROP TABLE $tbl_name"); pg_query($dbh, "CREATE TABLE $tbl_name (null_field INT, not_null_field INT NOT NULL)"); pg_insert($dbh, $tbl_name, array('null_field' => null, 'not_null_field' => 1)); @@ -31,11 +30,18 @@ echo $query, "\n"; var_dump(pg_fetch_all(pg_query($dbh, 'SELECT * FROM '. $tbl_name))); -@pg_query($dbh, "DROP TABLE $tbl_name"); pg_close($dbh); echo PHP_EOL."Done".PHP_EOL; +?> +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/bug68638.phpt b/ext/pgsql/tests/bug68638.phpt index ed30331d954df..0636b1d5abd75 100644 --- a/ext/pgsql/tests/bug68638.phpt +++ b/ext/pgsql/tests/bug68638.phpt @@ -30,8 +30,15 @@ while ($row = pg_fetch_assoc($rs)) { var_dump($row); } -pg_query($conn, "DROP TABLE $table"); +?> +--CLEAN-- + --EXPECT-- string(52) "UPDATE "test_68638" SET "value"=E'inf' WHERE "id"=1;" diff --git a/ext/pgsql/tests/bug71062.phpt b/ext/pgsql/tests/bug71062.phpt index 3977d796ea627..30caf75132818 100644 --- a/ext/pgsql/tests/bug71062.phpt +++ b/ext/pgsql/tests/bug71062.phpt @@ -30,10 +30,16 @@ pg_convert($db, $table, ['test_field' => $date_string_modified_iso8601]); print "done\n"; -pg_query($db, "DROP TABLE $table"); - ?> ==OK== +--CLEAN-- + --EXPECT-- trying format Y-m-d\TH:i:sO trying format Y-m-d H:i:sO diff --git a/ext/pgsql/tests/bug71998.phpt b/ext/pgsql/tests/bug71998.phpt index c507ca4b6a8cc..919218623cbcf 100644 --- a/ext/pgsql/tests/bug71998.phpt +++ b/ext/pgsql/tests/bug71998.phpt @@ -80,9 +80,15 @@ while (false != ($row = pg_fetch_row($r))) { } echo $errors, " errors caught\n"; -pg_query($db, "DROP TABLE tmp_statistics"); pg_close($db); +?> +--CLEAN-- + --EXPECT-- pg_insert(): Field "remote_addr" must be a valid IPv4 or IPv6 address string, "256.257.258.259" given diff --git a/ext/pgsql/tests/bug72028.phpt b/ext/pgsql/tests/bug72028.phpt index 8e6a62f3d34c0..6bfad86fa2eab 100644 --- a/ext/pgsql/tests/bug72028.phpt +++ b/ext/pgsql/tests/bug72028.phpt @@ -12,7 +12,7 @@ include('inc/config.inc'); $conn = pg_connect($conn_str); -$table = "bug72028_" . md5(uniqid(time())); +$table = "bug72028"; pg_query($conn, "CREATE TABLE $table (value TEXT, details TEXT);"); @@ -33,9 +33,14 @@ $r = pg_query($conn, "SELECT * FROM $table"); while (false !== ($i = pg_fetch_assoc($r))) { var_dump($i); } +?> +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/bug77047.phpt b/ext/pgsql/tests/bug77047.phpt index 16a3fdba1df02..b7b26b352f888 100644 --- a/ext/pgsql/tests/bug77047.phpt +++ b/ext/pgsql/tests/bug77047.phpt @@ -14,7 +14,6 @@ include 'inc/config.inc'; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE IF EXISTS bug77047"); pg_query($db, "CREATE TABLE bug77047 ( t TIME WITHOUT TIME ZONE )"); @@ -39,6 +38,13 @@ while (false !== ($row = pg_fetch_row($res))) { var_dump(array_pop($row)); } +?> +--CLEAN-- + --EXPECTF-- pg_insert(): Field "t" must be of type string|null, time given diff --git a/ext/pgsql/tests/gh10672.phpt b/ext/pgsql/tests/gh10672.phpt index 0eb6b258354f2..9c984841e25fd 100644 --- a/ext/pgsql/tests/gh10672.phpt +++ b/ext/pgsql/tests/gh10672.phpt @@ -13,7 +13,6 @@ declare(strict_types=1); include "inc/config.inc"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE IF EXISTS gh10672"); pg_query($db, "CREATE TABLE gh10672 (bar text);"); // Begin a transaction @@ -35,5 +34,12 @@ if ($oid === false) { echo 'The large object has been opened successfully.', PHP_EOL; ?> +--CLEAN-- + --EXPECT-- The large object has been opened successfully. diff --git a/ext/pgsql/tests/gh8253.phpt b/ext/pgsql/tests/gh8253.phpt index ad673c1b0497f..1ff11f22d41be 100644 --- a/ext/pgsql/tests/gh8253.phpt +++ b/ext/pgsql/tests/gh8253.phpt @@ -15,12 +15,18 @@ $a = ["bar" => "testing"]; fee($a["bar"]); $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE IF EXISTS gh8253"); pg_query($db, "CREATE TABLE gh8253 (bar text);"); pg_insert($db, "gh8253", $a); $res = pg_query($db, "SELECT * FROM gh8253"); var_dump(pg_fetch_all($res)); ?> +--CLEAN-- + --EXPECT-- array(1) { [0]=> diff --git a/ext/pgsql/tests/pg_delete_001.phpt b/ext/pgsql/tests/pg_delete_001.phpt index 12ce57bd4d0ff..5b769fc49aa97 100644 --- a/ext/pgsql/tests/pg_delete_001.phpt +++ b/ext/pgsql/tests/pg_delete_001.phpt @@ -41,10 +41,15 @@ var_dump(pg_fetch_all(pg_query($conn, 'SELECT * FROM phptests.foo'))); pg_delete($conn, 'bar', array('id' => 1, 'id2' => 2)); var_dump(pg_delete($conn, 'bar', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); +?> +--CLEAN-- + --EXPECTF-- string(43) "DELETE FROM "foo" WHERE "id"=1 AND "id2"=2;" diff --git a/ext/pgsql/tests/pg_insert_001.phpt b/ext/pgsql/tests/pg_insert_001.phpt index 3e6d2239c6e94..f6418f7723410 100644 --- a/ext/pgsql/tests/pg_insert_001.phpt +++ b/ext/pgsql/tests/pg_insert_001.phpt @@ -23,9 +23,14 @@ var_dump(pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2), PGSQL_DM var_dump(pg_select($conn, 'phptests.foo', array('id' => 1))); +?> +--CLEAN-- + --EXPECTF-- Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d diff --git a/ext/pgsql/tests/pg_meta_data_001.phpt b/ext/pgsql/tests/pg_meta_data_001.phpt index 970228dddc665..017b1e845ef67 100644 --- a/ext/pgsql/tests/pg_meta_data_001.phpt +++ b/ext/pgsql/tests/pg_meta_data_001.phpt @@ -22,11 +22,15 @@ var_dump(pg_meta_data($conn, 'foo')); var_dump(pg_meta_data($conn, 'phptests.foo')); var_dump(pg_meta_data($conn, 'phptests.foo', TRUE)); +?> +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/pg_select_001.phpt b/ext/pgsql/tests/pg_select_001.phpt index e9673e80c613e..e31dad28733af 100644 --- a/ext/pgsql/tests/pg_select_001.phpt +++ b/ext/pgsql/tests/pg_select_001.phpt @@ -42,10 +42,15 @@ var_dump(pg_select($conn, 'phptests.bar', array())); /* No array */ var_dump(pg_select($conn, 'phptests.bar')); +?> +--CLEAN-- + --EXPECTF-- Warning: pg_select(): Table 'foo' doesn't exists in %s on line %d diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt index a1156a3c747bb..fe359e3d2c277 100644 --- a/ext/pgsql/tests/pg_update_001.phpt +++ b/ext/pgsql/tests/pg_update_001.phpt @@ -31,10 +31,15 @@ while ($row = pg_fetch_assoc($rs)) { var_dump($row); } +?> +--CLEAN-- + --EXPECT-- string(38) "UPDATE "foo" SET "id"=10 WHERE "id"=1;" From 002fe321e0bd10fbb31ebb6fcd0b1015ff1fb6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Thu, 2 Nov 2023 23:36:00 +0900 Subject: [PATCH 03/17] refactor(ext/pgsql/tests): move table settings in config.inc to each test --- ext/pgsql/tests/01createdb.phpt | 22 ++++++++++++++----- ext/pgsql/tests/03sync_query.phpt | 11 ++++++++++ ext/pgsql/tests/04async_query.phpt | 11 ++++++++++ ext/pgsql/tests/06_bug73498.phpt | 15 +++++++++++++ ext/pgsql/tests/06copy.phpt | 10 +++++++++ ext/pgsql/tests/08escape.phpt | 11 ++++++++++ ext/pgsql/tests/10pg_convert_9.phpt | 11 ++++++++++ ext/pgsql/tests/10pg_convert_json_array.phpt | 10 +++++++++ ext/pgsql/tests/11pg_meta_data.phpt | 10 +++++++++ ext/pgsql/tests/12pg_insert_9.phpt | 15 +++++++++++-- ext/pgsql/tests/13pg_select_9.phpt | 18 ++++++++++++--- ext/pgsql/tests/14pg_update_9.phpt | 17 ++++++++++++-- ext/pgsql/tests/15pg_delete.phpt | 16 ++++++++++++-- ext/pgsql/tests/16pg_result_status.phpt | 10 +++++++++ ext/pgsql/tests/17result.phpt | 12 ++++++++++ ext/pgsql/tests/18pg_escape_bytea_before.phpt | 11 ++++++++++ ext/pgsql/tests/18pg_escape_bytea_esc.phpt | 11 ++++++++++ ext/pgsql/tests/18pg_escape_bytea_hex.phpt | 11 ++++++++++ ext/pgsql/tests/22pg_fetch_object.phpt | 11 ++++++++++ ext/pgsql/tests/23sync_query_params.phpt | 12 ++++++++++ ext/pgsql/tests/24sync_query_prepared.phpt | 11 ++++++++++ ext/pgsql/tests/25async_query_params.phpt | 12 ++++++++++ ext/pgsql/tests/26async_query_prepared.phpt | 12 ++++++++++ ext/pgsql/tests/30nb_async_query_params.phpt | 12 ++++++++++ .../tests/31nb_async_query_prepared.phpt | 12 ++++++++++ ext/pgsql/tests/32nb_async_query.phpt | 12 ++++++++++ ext/pgsql/tests/98old_api.phpt | 14 ++++++++++-- ext/pgsql/tests/9999dropdb.phpt | 7 ++++++ ext/pgsql/tests/inc/config.inc | 12 +--------- 29 files changed, 331 insertions(+), 28 deletions(-) diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt index fa850823cb698..366f3729c309d 100644 --- a/ext/pgsql/tests/01createdb.phpt +++ b/ext/pgsql/tests/01createdb.phpt @@ -9,14 +9,14 @@ pgsql // create test table include('inc/config.inc'); +$table_name = 'table_01createdb'; +$table_name_92 = 'table_01createdb_92'; +$view_name = "view_01createdb"; $db = pg_connect($conn_str); if (!($q = @pg_query($db, "SELECT * FROM ".$table_name)) || !@pg_num_rows($q)) { - pg_query($db,$table_def); // Create table here - for ($i=0; $i < $num_test_record; $i++) { - pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');"); - } + pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); // Create table here } else { echo pg_last_error()."\n"; @@ -25,18 +25,28 @@ else { $v = pg_version($db); if (version_compare($v['server'], '9.2', '>=') && (!($q = @pg_query($db, "SELECT * FROM ".$table_name_92)) || !@pg_num_rows($q))) { - pg_query($db,$table_def_92); // Create table here + pg_query($db, "CREATE TABLE {$table_name_92} (textary text[], jsn json)"); // Create table here } else { echo pg_last_error()."\n"; } // Create view here -pg_query($db,$view_def); +pg_query($db, "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name}"); pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt index f3c30b3e61d61..1e27200636cc1 100644 --- a/ext/pgsql/tests/03sync_query.phpt +++ b/ext/pgsql/tests/03sync_query.phpt @@ -8,8 +8,11 @@ pgsql +--CLEAN-- + --EXPECT-- Argument #3 must be greater than or equal to 0 Argument #3 must be less than the number of fields for this result set diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt index 64a9ca4ef54e4..d7553101337e3 100644 --- a/ext/pgsql/tests/04async_query.phpt +++ b/ext/pgsql/tests/04async_query.phpt @@ -8,8 +8,11 @@ pgsql +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/06_bug73498.phpt b/ext/pgsql/tests/06_bug73498.phpt index 6922e617ae175..8a20b77d75ed0 100644 --- a/ext/pgsql/tests/06_bug73498.phpt +++ b/ext/pgsql/tests/06_bug73498.phpt @@ -8,14 +8,29 @@ pgsql 0); +?> +--CLEAN-- + --EXPECT-- string(5) "array" diff --git a/ext/pgsql/tests/06copy.phpt b/ext/pgsql/tests/06copy.phpt index 13807162f276f..aeb518b0fc864 100644 --- a/ext/pgsql/tests/06copy.phpt +++ b/ext/pgsql/tests/06copy.phpt @@ -8,8 +8,10 @@ pgsql +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt index f77a2365d68f4..0a6979af48e2e 100644 --- a/ext/pgsql/tests/08escape.phpt +++ b/ext/pgsql/tests/08escape.phpt @@ -8,6 +8,8 @@ pgsql +--CLEAN-- + --EXPECTF-- Deprecated: pg_escape_string(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d diff --git a/ext/pgsql/tests/10pg_convert_9.phpt b/ext/pgsql/tests/10pg_convert_9.phpt index d3a3f3f116f2c..577d2cc20468b 100644 --- a/ext/pgsql/tests/10pg_convert_9.phpt +++ b/ext/pgsql/tests/10pg_convert_9.phpt @@ -12,8 +12,11 @@ skip_bytea_not_hex(); error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = "table_10pg_convert_9"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); + pg_query($db, "SET standard_conforming_strings = 0"); $fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB'); @@ -49,6 +52,14 @@ try { echo $e->getMessage(), \PHP_EOL; } ?> +--CLEAN-- + --EXPECT-- array(3) { [""num""]=> diff --git a/ext/pgsql/tests/10pg_convert_json_array.phpt b/ext/pgsql/tests/10pg_convert_json_array.phpt index 407d6e2acfc75..df032980c462d 100644 --- a/ext/pgsql/tests/10pg_convert_json_array.phpt +++ b/ext/pgsql/tests/10pg_convert_json_array.phpt @@ -12,8 +12,10 @@ skip_server_version('9.2'); error_reporting(E_ALL); include 'inc/config.inc'; +$table_name_92 = "table_10pg_convert_json_array_92"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name_92} (textary text[], jsn json)"); $fields = array( 'textary'=>'{"meeting", "lunch", "training", "presentation"}', @@ -28,6 +30,14 @@ if (!pg_insert($db, $table_name_92, $fields)) { echo "OK\n"; } +?> +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/11pg_meta_data.phpt b/ext/pgsql/tests/11pg_meta_data.phpt index cfdb059a395bc..d01f6719abbb3 100644 --- a/ext/pgsql/tests/11pg_meta_data.phpt +++ b/ext/pgsql/tests/11pg_meta_data.phpt @@ -9,13 +9,23 @@ pgsql error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = "table_11pg_meta_data"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); $meta = pg_meta_data($db, $table_name); var_dump($meta); ?> +--CLEAN-- + --EXPECT-- array(3) { ["num"]=> diff --git a/ext/pgsql/tests/12pg_insert_9.phpt b/ext/pgsql/tests/12pg_insert_9.phpt index 32399464c77c4..a51d9a8eaae5e 100644 --- a/ext/pgsql/tests/12pg_insert_9.phpt +++ b/ext/pgsql/tests/12pg_insert_9.phpt @@ -12,8 +12,11 @@ skip_bytea_not_hex(); error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = "table_12pg_insert_9"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); + pg_query($db, "SET standard_conforming_strings = 0"); $fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB'); @@ -53,9 +56,17 @@ try { echo "Ok\n"; ?> +--CLEAN-- + --EXPECTF-- -INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242'); -INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES ('1234','AAA','BBB'); +INSERT INTO "table_12pg_insert_9" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242'); +INSERT INTO "table_12pg_insert_9" ("num","str","bin") VALUES ('1234','AAA','BBB'); object(PgSql\Result)#%d (0) { } Array of values must be an associative array with string keys diff --git a/ext/pgsql/tests/13pg_select_9.phpt b/ext/pgsql/tests/13pg_select_9.phpt index 43d71dff0c291..771bd1f3e5bd7 100644 --- a/ext/pgsql/tests/13pg_select_9.phpt +++ b/ext/pgsql/tests/13pg_select_9.phpt @@ -12,11 +12,15 @@ skip_server_version('9.0', '<'); error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = "table_13pg_select_9"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "insert into {$table_name} values(1234, 'AAA', 'BBB')"); +pg_query($db, "insert into {$table_name} values(1234, 'AAA', 'BBB')"); + pg_query($db, "SET bytea_output = 'hex'"); -$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ'); $ids = array('num'=>'1234'); $res = pg_select($db, $table_name, $ids) or print "Error\n"; @@ -54,6 +58,14 @@ try { echo "Ok\n"; +?> +--CLEAN-- + --EXPECT-- array(2) { @@ -76,8 +88,8 @@ array(2) { string(8) "\x424242" } } -SELECT * FROM "php_pgsql_test" WHERE "num"=1234; -SELECT * FROM "php_pgsql_test" WHERE "num"='1234'; +SELECT * FROM "table_13pg_select_9" WHERE "num"=1234; +SELECT * FROM "table_13pg_select_9" WHERE "num"='1234'; Array of values must be an associative array with string keys Array of values must be an associative array with string keys Values must be of type string|int|float|bool|null, array given diff --git a/ext/pgsql/tests/14pg_update_9.phpt b/ext/pgsql/tests/14pg_update_9.phpt index bf16cb799288e..4f3066268f634 100644 --- a/ext/pgsql/tests/14pg_update_9.phpt +++ b/ext/pgsql/tests/14pg_update_9.phpt @@ -12,8 +12,13 @@ skip_bytea_not_hex(); error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = "table_14pg_update_9"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); +pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); + pg_query($db, "SET standard_conforming_strings = 0"); $fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ'); @@ -25,7 +30,15 @@ echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING|PGSQL_DML_ESCAP echo "Ok\n"; ?> +--CLEAN-- + --EXPECT-- -UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234; -UPDATE "php_pgsql_test" SET "num"='1234',"str"='ABC',"bin"='XYZ' WHERE "num"='1234'; +UPDATE "table_14pg_update_9" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234; +UPDATE "table_14pg_update_9" SET "num"='1234',"str"='ABC',"bin"='XYZ' WHERE "num"='1234'; Ok diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt index a65f10082bab9..90ab8f625068d 100644 --- a/ext/pgsql/tests/15pg_delete.phpt +++ b/ext/pgsql/tests/15pg_delete.phpt @@ -9,8 +9,12 @@ pgsql error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = "table_15pg_delete"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); +pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); $fields = array('num'=>'1234', 'str'=>'XXX', 'bin'=>'YYY'); $ids = array('num'=>'1234'); @@ -23,7 +27,15 @@ else { echo "Ok\n"; } ?> +--CLEAN-- + --EXPECT-- -DELETE FROM "php_pgsql_test" WHERE "num"=1234; -DELETE FROM "php_pgsql_test" WHERE "num"='1234'; +DELETE FROM "table_15pg_delete" WHERE "num"=1234; +DELETE FROM "table_15pg_delete" WHERE "num"='1234'; Ok diff --git a/ext/pgsql/tests/16pg_result_status.phpt b/ext/pgsql/tests/16pg_result_status.phpt index 9d8aee54cf973..aff43094b4ed0 100644 --- a/ext/pgsql/tests/16pg_result_status.phpt +++ b/ext/pgsql/tests/16pg_result_status.phpt @@ -7,8 +7,10 @@ pgsql --FILE-- +--CLEAN-- + --EXPECT-- 1 COMMIT diff --git a/ext/pgsql/tests/17result.phpt b/ext/pgsql/tests/17result.phpt index 6d6863ddad4f0..74e839ee5c744 100644 --- a/ext/pgsql/tests/17result.phpt +++ b/ext/pgsql/tests/17result.phpt @@ -9,8 +9,12 @@ pgsql error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = "table_17result"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); +pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); $sql = "SELECT * FROM $table_name ORDER BY num"; $result = pg_query($db, $sql) or die('Cannot query db'); @@ -25,6 +29,14 @@ var_dump(pg_result_seek($result, 0)); echo "Ok\n"; ?> +--CLEAN-- + --EXPECTF-- bool(true) object(stdClass)#%d (3) { diff --git a/ext/pgsql/tests/18pg_escape_bytea_before.phpt b/ext/pgsql/tests/18pg_escape_bytea_before.phpt index b6a479688af7c..85b8390dfcaed 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_before.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_before.phpt @@ -9,11 +9,14 @@ pgsql // optional functions include('inc/config.inc'); +$table_name = "table_18pg_escape_bytea_before"; $image = file_get_contents(__DIR__ . '/php.gif'); $esc_image = pg_escape_bytea($image); $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); + @pg_query($db, "SET bytea_output = 'escape'"); pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, E\''.$esc_image.'\');'); @@ -28,6 +31,14 @@ else { echo "OK"; } ?> +--CLEAN-- + --EXPECTF-- Deprecated: pg_escape_bytea(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d OK diff --git a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt index 7e6f45d2c6689..9f76ce8696ad3 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt @@ -9,8 +9,11 @@ pgsql // optional functions include('inc/config.inc'); +$table_name = "table_18pg_escape_bytea_esc"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); + @pg_query($db, "SET bytea_output = 'escape'"); $image = file_get_contents(__DIR__ . '/php.gif'); @@ -28,5 +31,13 @@ else { echo "OK"; } ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt index 59083eee92707..e0002697ce348 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt @@ -12,8 +12,11 @@ skip_bytea_not_hex(); // optional functions include('inc/config.inc'); +$table_name = "table_18pg_escape_bytea_hex"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); + @pg_query($db, "SET bytea_output = 'hex'"); $image = file_get_contents(__DIR__ . '/php.gif'); @@ -31,5 +34,13 @@ else { echo "OK"; } ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/22pg_fetch_object.phpt b/ext/pgsql/tests/22pg_fetch_object.phpt index baaa31489f73a..4997745832887 100644 --- a/ext/pgsql/tests/22pg_fetch_object.phpt +++ b/ext/pgsql/tests/22pg_fetch_object.phpt @@ -9,6 +9,7 @@ pgsql error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = "table_22pg_fetch_object"; class test_class { function __construct($arg1, $arg2) { @@ -17,6 +18,8 @@ class test_class { } $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "insert into {$table_name} values(0, 'ABC', null)"); $sql = "SELECT * FROM $table_name WHERE num = 0"; $result = pg_query($db, $sql) or die('Cannot query db'); @@ -32,6 +35,14 @@ try { echo "Ok\n"; ?> +--CLEAN-- + --EXPECTF-- test_class::__construct(1,2) object(test_class)#%d (3) { diff --git a/ext/pgsql/tests/23sync_query_params.phpt b/ext/pgsql/tests/23sync_query_params.phpt index 00562a829f1f9..44ee64a0ec251 100644 --- a/ext/pgsql/tests/23sync_query_params.phpt +++ b/ext/pgsql/tests/23sync_query_params.phpt @@ -11,8 +11,12 @@ if (!function_exists('pg_query_params')) die('skip function pg_query_params() do \$1;", array(100)); if (!($rows = pg_num_rows($result))) { @@ -53,5 +57,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt index 981792c2a8484..ecb7be84a0a13 100644 --- a/ext/pgsql/tests/24sync_query_prepared.phpt +++ b/ext/pgsql/tests/24sync_query_prepared.phpt @@ -11,8 +11,11 @@ if (!function_exists('pg_prepare')) die('skip function pg_prepare() does not exi \$1;"); pg_result_error($result); @@ -60,5 +63,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt index 37d3cff037b36..170727e58f9f0 100644 --- a/ext/pgsql/tests/25async_query_params.phpt +++ b/ext/pgsql/tests/25async_query_params.phpt @@ -11,8 +11,12 @@ if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_p \$1;", array(100))) { echo "pg_send_query_params() error\n"; } @@ -64,5 +68,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt index 72099b83d13f8..88b3fd5d87cdd 100644 --- a/ext/pgsql/tests/26async_query_prepared.phpt +++ b/ext/pgsql/tests/26async_query_prepared.phpt @@ -11,8 +11,12 @@ if (!function_exists('pg_send_prepare')) die('skip function pg_send_prepare() do \$1;")) { echo "pg_send_prepare() error\n"; } @@ -100,5 +104,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt index 36c6103fb0017..6547fb078a20d 100644 --- a/ext/pgsql/tests/30nb_async_query_params.phpt +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -12,8 +12,12 @@ if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_p include('inc/config.inc'); include('inc/nonblocking.inc'); +$table_name = "table_30nb_async_query_params"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "insert into {$table_name} (num) values(1000)"); + $db_socket = pg_socket($db); stream_set_blocking($db_socket, false); @@ -69,5 +73,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt index 72ae84bed37ab..7bb6ab6ec9ee8 100644 --- a/ext/pgsql/tests/31nb_async_query_prepared.phpt +++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt @@ -12,8 +12,12 @@ if (!function_exists('pg_send_prepare')) die('skip function pg_send_prepare() do include('inc/config.inc'); include('inc/nonblocking.inc'); +$table_name = "table_31nb_async_query_prepared"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "insert into {$table_name} (num) values(1000)"); + $db_socket = pg_socket($db); stream_set_blocking($db_socket, false); @@ -102,5 +106,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt index 8672986759ecf..4f2792cc0dcdc 100644 --- a/ext/pgsql/tests/32nb_async_query.phpt +++ b/ext/pgsql/tests/32nb_async_query.phpt @@ -12,8 +12,12 @@ if (!function_exists('pg_send_prepare')) die('skip function pg_send_prepare() do include('inc/config.inc'); include('inc/nonblocking.inc'); +$table_name = "table_32nb_async_query"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "insert into {$table_name} default values"); + $db_socket = pg_socket($db); stream_set_blocking($db_socket, false); @@ -74,5 +78,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/98old_api.phpt b/ext/pgsql/tests/98old_api.phpt index d48ba77a8b062..5819c70788add 100644 --- a/ext/pgsql/tests/98old_api.phpt +++ b/ext/pgsql/tests/98old_api.phpt @@ -8,8 +8,12 @@ pgsql +--CLEAN-- + --EXPECTF-- Deprecated: Function pg_numrows() is deprecated in %s on line %d diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt index 3766d8d43b400..63f9d4e324bec 100644 --- a/ext/pgsql/tests/9999dropdb.phpt +++ b/ext/pgsql/tests/9999dropdb.phpt @@ -9,8 +9,15 @@ pgsql // drop test table include('inc/config.inc'); +$table_name = "table_9999dropdb"; +$table_name_92 = "table_9999dropdb_92"; +$view_name = "view_9999dropdb"; $db = pg_connect($conn_str); +pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "create table {$table_name_92} (textary text[], jsn json)"); +pg_query($db, "create view {$view_name} as select * from {$table_name}"); + pg_query($db, "DROP VIEW {$view_name}"); pg_query($db, "DROP TABLE ".$table_name); @pg_query($db, "DROP TABLE ".$table_name_92); diff --git a/ext/pgsql/tests/inc/config.inc b/ext/pgsql/tests/inc/config.inc index 66ba4810203af..4bdb98cf4f75f 100644 --- a/ext/pgsql/tests/inc/config.inc +++ b/ext/pgsql/tests/inc/config.inc @@ -1,23 +1,13 @@ From 293b0b01eacef73a7281dd988ffc82046e9148d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Fri, 3 Nov 2023 16:42:21 +0900 Subject: [PATCH 04/17] refactor(ext/pgsql/tests): move variable in config.inc to each test --- ext/pgsql/tests/03sync_query.phpt | 2 +- ext/pgsql/tests/04async_query.phpt | 2 +- ext/pgsql/tests/23sync_query_params.phpt | 2 +- ext/pgsql/tests/24sync_query_prepared.phpt | 2 +- ext/pgsql/tests/25async_query_params.phpt | 2 +- ext/pgsql/tests/26async_query_prepared.phpt | 2 +- ext/pgsql/tests/30nb_async_query_params.phpt | 2 +- ext/pgsql/tests/31nb_async_query_prepared.phpt | 2 +- ext/pgsql/tests/32nb_async_query.phpt | 2 +- ext/pgsql/tests/inc/config.inc | 4 ---- 10 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt index 1e27200636cc1..e1b37eb7b3c33 100644 --- a/ext/pgsql/tests/03sync_query.phpt +++ b/ext/pgsql/tests/03sync_query.phpt @@ -86,7 +86,7 @@ if (function_exists('pg_result_error_field')) { pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";")); pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";")); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt index d7553101337e3..43a1123c5d4dc 100644 --- a/ext/pgsql/tests/04async_query.phpt +++ b/ext/pgsql/tests/04async_query.phpt @@ -49,7 +49,7 @@ for ($i=0; $i < $rows; $i++) pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";")); pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";")); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); diff --git a/ext/pgsql/tests/23sync_query_params.phpt b/ext/pgsql/tests/23sync_query_params.phpt index 44ee64a0ec251..64cba52248e9d 100644 --- a/ext/pgsql/tests/23sync_query_params.phpt +++ b/ext/pgsql/tests/23sync_query_params.phpt @@ -43,7 +43,7 @@ pg_result_error($result); pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, null, 0); diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt index ecb7be84a0a13..bdd8264a87900 100644 --- a/ext/pgsql/tests/24sync_query_prepared.phpt +++ b/ext/pgsql/tests/24sync_query_prepared.phpt @@ -46,7 +46,7 @@ pg_result_error($result); pg_num_rows(pg_execute($db, "php_test", array(100))); pg_num_fields(pg_execute($db, "php_test", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt index 170727e58f9f0..a7019f7d235ff 100644 --- a/ext/pgsql/tests/25async_query_params.phpt +++ b/ext/pgsql/tests/25async_query_params.phpt @@ -51,7 +51,7 @@ for ($i=0; $i < $rows; $i++) pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt index 88b3fd5d87cdd..fcec2319eafaa 100644 --- a/ext/pgsql/tests/26async_query_prepared.phpt +++ b/ext/pgsql/tests/26async_query_prepared.phpt @@ -65,7 +65,7 @@ for ($i=0; $i < $rows; $i++) pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt index 6547fb078a20d..f54761fdbf60e 100644 --- a/ext/pgsql/tests/30nb_async_query_params.phpt +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -52,7 +52,7 @@ for ($i=0; $i < $rows; $i++) { pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt index 7bb6ab6ec9ee8..40e1da5731237 100644 --- a/ext/pgsql/tests/31nb_async_query_prepared.phpt +++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt @@ -67,7 +67,7 @@ for ($i=0; $i < $rows; $i++) { pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt index 4f2792cc0dcdc..6f529bb817441 100644 --- a/ext/pgsql/tests/32nb_async_query.phpt +++ b/ext/pgsql/tests/32nb_async_query.phpt @@ -53,7 +53,7 @@ for ($i=0; $i < $rows; $i++) { pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";")); pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";")); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, null, 0); diff --git a/ext/pgsql/tests/inc/config.inc b/ext/pgsql/tests/inc/config.inc index 4bdb98cf4f75f..b01b120723d9f 100644 --- a/ext/pgsql/tests/inc/config.inc +++ b/ext/pgsql/tests/inc/config.inc @@ -6,8 +6,4 @@ // "test" database must exist. i.e. "createdb test" before testing $conn_str = getenv('PGSQL_TEST_CONNSTR') ?: "host=localhost dbname=test port=5432 user=postgres password=postgres"; // connection string - -// Test table -$field_name = "num"; // For pg_field_num() - ?> From 5ab45c70b9c5829493ece0f0b5cba522e4764e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Sat, 4 Nov 2023 15:23:48 +0900 Subject: [PATCH 05/17] refactor(ext/pgsql/tests): fixed hard-coded object names and unified style --- ext/pgsql/tests/06copy_2.phpt | 12 +++--- ext/pgsql/tests/80_bug24499.phpt | 13 ++++--- ext/pgsql/tests/80_bug27597.phpt | 12 +++--- ext/pgsql/tests/80_bug39971.phpt | 12 +++--- ext/pgsql/tests/80_bug42783.phpt | 12 +++--- ext/pgsql/tests/bug37100.phpt | 14 ++++--- ext/pgsql/tests/bug37100_9.phpt | 14 ++++--- ext/pgsql/tests/bug64609.phpt | 8 ++-- ext/pgsql/tests/bug65119.phpt | 6 ++- ext/pgsql/tests/bug71998.phpt | 13 ++++--- ext/pgsql/tests/bug77047.phpt | 22 ++++++----- ext/pgsql/tests/gh10672.phpt | 8 ++-- ext/pgsql/tests/gh8253.phpt | 12 +++--- ext/pgsql/tests/pg_delete_001.phpt | 53 +++++++++++++++------------ ext/pgsql/tests/pg_insert_001.phpt | 26 +++++++------ ext/pgsql/tests/pg_meta_data_001.phpt | 24 +++++++----- ext/pgsql/tests/pg_select_001.phpt | 33 +++++++++-------- ext/pgsql/tests/pg_update_001.phpt | 35 ++++++++++-------- 18 files changed, 188 insertions(+), 141 deletions(-) diff --git a/ext/pgsql/tests/06copy_2.phpt b/ext/pgsql/tests/06copy_2.phpt index 789c943138e42..306df8cae2eaa 100644 --- a/ext/pgsql/tests/06copy_2.phpt +++ b/ext/pgsql/tests/06copy_2.phpt @@ -8,26 +8,28 @@ pgsql --CLEAN-- --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/80_bug24499.phpt b/ext/pgsql/tests/80_bug24499.phpt index 12fe17f9910e0..757ba00f34cbe 100644 --- a/ext/pgsql/tests/80_bug24499.phpt +++ b/ext/pgsql/tests/80_bug24499.phpt @@ -10,16 +10,17 @@ require_once('inc/skipif.inc'); --EXPECTF-- Array diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt index fa73ca0634126..c000ba56cccc3 100644 --- a/ext/pgsql/tests/80_bug27597.phpt +++ b/ext/pgsql/tests/80_bug27597.phpt @@ -10,16 +10,17 @@ require_once('inc/skipif.inc'); --EXPECT-- Array diff --git a/ext/pgsql/tests/80_bug39971.phpt b/ext/pgsql/tests/80_bug39971.phpt index 4564694697df1..4858912f81581 100644 --- a/ext/pgsql/tests/80_bug39971.phpt +++ b/ext/pgsql/tests/80_bug39971.phpt @@ -10,16 +10,17 @@ require_once('inc/skipif.inc'); 'now()'); -pg_insert($dbh, 'php_test', $values); +pg_insert($dbh, $table_name, $values); $ids = array('id' => 1); -pg_update($dbh, 'php_test', $values, $ids); +pg_update($dbh, $table_name, $values, $ids); pg_close($dbh); ?> @@ -27,9 +28,10 @@ pg_close($dbh); --CLEAN-- --EXPECT-- ===DONE=== diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt index e401411c3b193..775566270acb1 100644 --- a/ext/pgsql/tests/80_bug42783.phpt +++ b/ext/pgsql/tests/80_bug42783.phpt @@ -10,26 +10,28 @@ require_once('inc/skipif.inc'); --CLEAN-- --EXPECTF-- array(2) { diff --git a/ext/pgsql/tests/bug37100.phpt b/ext/pgsql/tests/bug37100.phpt index b60603e2dd8a1..c5977a8530e44 100644 --- a/ext/pgsql/tests/bug37100.phpt +++ b/ext/pgsql/tests/bug37100.phpt @@ -11,20 +11,21 @@ skip_bytea_not_escape(); --EXPECT-- string(24) "\001\003\252\000\010\022" diff --git a/ext/pgsql/tests/bug37100_9.phpt b/ext/pgsql/tests/bug37100_9.phpt index 3e17e57ab226d..6b79cd9290f30 100644 --- a/ext/pgsql/tests/bug37100_9.phpt +++ b/ext/pgsql/tests/bug37100_9.phpt @@ -11,19 +11,20 @@ skip_bytea_not_hex(); --EXPECT-- string(14) "\x0103aa000812" diff --git a/ext/pgsql/tests/bug64609.phpt b/ext/pgsql/tests/bug64609.phpt index f6d63d700d64b..67e10a3986cb7 100644 --- a/ext/pgsql/tests/bug64609.phpt +++ b/ext/pgsql/tests/bug64609.phpt @@ -12,14 +12,16 @@ skip_server_version('8.3', '<'); error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = 'table_bug64609'; +$type_name = 'type_bug64609'; $db = pg_connect($conn_str); pg_query($db, "BEGIN"); -pg_query($db, "CREATE TYPE t_enum AS ENUM ('ok', 'ko')"); -pg_query($db, "CREATE TABLE test_enum (a t_enum)"); +pg_query($db, "CREATE TYPE {$type_name} AS ENUM ('ok', 'ko')"); +pg_query($db, "CREATE TABLE {$table_name} (a {$type_name})"); $fields = array('a' => 'ok'); -$converted = pg_convert($db, 'test_enum', $fields); +$converted = pg_convert($db, $table_name, $fields); pg_query($db, "ROLLBACK"); diff --git a/ext/pgsql/tests/bug65119.phpt b/ext/pgsql/tests/bug65119.phpt index cfcb1378ef74f..530162db2dbc1 100644 --- a/ext/pgsql/tests/bug65119.phpt +++ b/ext/pgsql/tests/bug65119.phpt @@ -9,12 +9,14 @@ include("inc/skipif.inc"); --FILE-- ++$i, "remote_addr" => $ip); $r = true; try { - @pg_insert($db, 'tmp_statistics', $data); + @pg_insert($db, $table_name, $data); } catch (\ValueError $e) { echo $e->getMessage() . PHP_EOL; $r = false; @@ -70,11 +71,11 @@ foreach ($ips as $ip) { //echo pg_last_error($db); } - //pg_query($db, "INSERT INTO tmp_statistics (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted + //pg_query($db, "INSERT INTO {$table_name} (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted } -$r = pg_query($db, "SELECT * FROM tmp_statistics"); +$r = pg_query($db, "SELECT * FROM {$table_name}"); while (false != ($row = pg_fetch_row($r))) { var_dump($row); } @@ -86,9 +87,11 @@ pg_close($db); --CLEAN-- --EXPECT-- pg_insert(): Field "remote_addr" must be a valid IPv4 or IPv6 address string, "256.257.258.259" given diff --git a/ext/pgsql/tests/bug77047.phpt b/ext/pgsql/tests/bug77047.phpt index b7b26b352f888..4c0296d108095 100644 --- a/ext/pgsql/tests/bug77047.phpt +++ b/ext/pgsql/tests/bug77047.phpt @@ -11,29 +11,30 @@ include("inc/skipif.inc"); error_reporting(E_ALL); include 'inc/config.inc'; +$table_name = 'table_bug77047'; $db = pg_connect($conn_str); -pg_query($db, "CREATE TABLE bug77047 ( +pg_query($db, "CREATE TABLE {$table_name} ( t TIME WITHOUT TIME ZONE )"); try { - pg_insert($db, "bug77047", array("t" => "13:31")); + pg_insert($db, $table_name, array("t" => "13:31")); } catch (\TypeError $e) { echo $e->getMessage(); } -pg_insert($db, "bug77047", array("t" => "13:31:13")); -pg_insert($db, "bug77047", array("t" => "1:2:3")); +pg_insert($db, $table_name, array("t" => "13:31:13")); +pg_insert($db, $table_name, array("t" => "1:2:3")); try { - pg_insert($db, "bug77047", array("t" => "xyz")); + pg_insert($db, $table_name, array("t" => "xyz")); } catch (\TypeError $e) { echo $e->getMessage() . PHP_EOL; } -pg_insert($db, "bug77047", array("t" => NULL)); -pg_insert($db, "bug77047", array("t" => "")); +pg_insert($db, $table_name, array("t" => NULL)); +pg_insert($db, $table_name, array("t" => "")); -$res = pg_query($db, "SELECT t FROM bug77047"); +$res = pg_query($db, "SELECT t FROM {$table_name}"); while (false !== ($row = pg_fetch_row($res))) { var_dump(array_pop($row)); } @@ -42,9 +43,10 @@ while (false !== ($row = pg_fetch_row($res))) { --CLEAN-- --EXPECTF-- pg_insert(): Field "t" must be of type string|null, time given diff --git a/ext/pgsql/tests/gh10672.phpt b/ext/pgsql/tests/gh10672.phpt index 9c984841e25fd..6ed189da0847e 100644 --- a/ext/pgsql/tests/gh10672.phpt +++ b/ext/pgsql/tests/gh10672.phpt @@ -11,9 +11,10 @@ include("inc/skipif.inc"); declare(strict_types=1); include "inc/config.inc"; +$table_name = 'table_gh10672'; $db = pg_connect($conn_str); -pg_query($db, "CREATE TABLE gh10672 (bar text);"); +pg_query($db, "CREATE TABLE {$table_name} (bar text);"); // Begin a transaction pg_query($db, 'BEGIN'); @@ -37,9 +38,10 @@ echo 'The large object has been opened successfully.', PHP_EOL; --CLEAN-- --EXPECT-- The large object has been opened successfully. diff --git a/ext/pgsql/tests/gh8253.phpt b/ext/pgsql/tests/gh8253.phpt index 1ff11f22d41be..0f48ddcb83bfa 100644 --- a/ext/pgsql/tests/gh8253.phpt +++ b/ext/pgsql/tests/gh8253.phpt @@ -9,23 +9,25 @@ include("inc/skipif.inc"); --FILE-- "testing"]; fee($a["bar"]); $db = pg_connect($conn_str); -pg_query($db, "CREATE TABLE gh8253 (bar text);"); -pg_insert($db, "gh8253", $a); -$res = pg_query($db, "SELECT * FROM gh8253"); +pg_query($db, "CREATE TABLE {$table_name} (bar text);"); +pg_insert($db, $table_name, $a); +$res = pg_query($db, "SELECT * FROM {$table_name}"); var_dump(pg_fetch_all($res)); ?> --CLEAN-- --EXPECT-- array(1) { diff --git a/ext/pgsql/tests/pg_delete_001.phpt b/ext/pgsql/tests/pg_delete_001.phpt index 5b769fc49aa97..26b3c4de9e425 100644 --- a/ext/pgsql/tests/pg_delete_001.phpt +++ b/ext/pgsql/tests/pg_delete_001.phpt @@ -8,34 +8,36 @@ pgsql 1, 'id2' => 1)); -pg_insert($conn, 'foo', array('id' => 1, 'id2' => 2)); -pg_insert($conn, 'foo', array('id' => 1, 'id2' => 2)); -pg_insert($conn, 'foo', array('id' => 3, 'id2' => 3)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 1)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 2)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 2)); +pg_insert($conn, $table_name, array('id' => 3, 'id2' => 3)); -pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 1)); -pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2)); -pg_insert($conn, 'phptests.foo', array('id' => 2, 'id2' => 3)); -pg_insert($conn, 'phptests.foo', array('id' => 2, 'id2' => 3)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 1)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 2)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 3)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 3)); -pg_delete($conn, 'foo', array('id' => 1, 'id2' => 0)); -pg_delete($conn, 'foo', array('id' => 1, 'id2' => 2)); -var_dump(pg_delete($conn, 'foo', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); +pg_delete($conn, $table_name, array('id' => 1, 'id2' => 0)); +pg_delete($conn, $table_name, array('id' => 1, 'id2' => 2)); +var_dump(pg_delete($conn, $table_name, array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); -pg_delete($conn, 'phptests.foo', array('id' => 2, 'id2' => 1)); -pg_delete($conn, 'phptests.foo', array('id' => 2, 'id2' => 3)); -var_dump(pg_delete($conn, 'phptests.foo', array('id' => 2, 'id2' => 3), PGSQL_DML_STRING)); +pg_delete($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 1)); +pg_delete($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 3)); +var_dump(pg_delete($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 3), PGSQL_DML_STRING)); -var_dump(pg_fetch_all(pg_query($conn, 'SELECT * FROM foo'))); -var_dump(pg_fetch_all(pg_query($conn, 'SELECT * FROM phptests.foo'))); +var_dump(pg_fetch_all(pg_query($conn, "SELECT * FROM {$table_name}"))); +var_dump(pg_fetch_all(pg_query($conn, "SELECT * FROM {$schema_name}.{$table_name}"))); /* Inexistent */ pg_delete($conn, 'bar', array('id' => 1, 'id2' => 2)); @@ -45,15 +47,18 @@ var_dump(pg_delete($conn, 'bar', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING) --CLEAN-- --EXPECTF-- -string(43) "DELETE FROM "foo" WHERE "id"=1 AND "id2"=2;" -string(54) "DELETE FROM "phptests"."foo" WHERE "id"=2 AND "id2"=3;" +string(59) "DELETE FROM "table_pg_delete_001" WHERE "id"=1 AND "id2"=2;" +string(82) "DELETE FROM "schema_pg_delete_001"."table_pg_delete_001" WHERE "id"=2 AND "id2"=3;" array(2) { [0]=> array(2) { diff --git a/ext/pgsql/tests/pg_insert_001.phpt b/ext/pgsql/tests/pg_insert_001.phpt index f6418f7723410..62835fa546a8a 100644 --- a/ext/pgsql/tests/pg_insert_001.phpt +++ b/ext/pgsql/tests/pg_insert_001.phpt @@ -8,33 +8,37 @@ pgsql 1, 'id2' => 1)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 1)); -pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 2)); -var_dump(pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); +var_dump(pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); -var_dump(pg_select($conn, 'phptests.foo', array('id' => 1))); +var_dump(pg_select($conn, "{$schema_name}.{$table_name}", array('id' => 1))); ?> --CLEAN-- --EXPECTF-- -Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d -string(55) "INSERT INTO "phptests"."foo" ("id","id2") VALUES (1,2);" +Warning: pg_insert(): Table 'table_pg_insert_001' doesn't exists in %s on line %d +string(83) "INSERT INTO "schema_pg_insert_001"."table_pg_insert_001" ("id","id2") VALUES (1,2);" array(1) { [0]=> array(2) { diff --git a/ext/pgsql/tests/pg_meta_data_001.phpt b/ext/pgsql/tests/pg_meta_data_001.phpt index 017b1e845ef67..ed8d79a9d0fff 100644 --- a/ext/pgsql/tests/pg_meta_data_001.phpt +++ b/ext/pgsql/tests/pg_meta_data_001.phpt @@ -8,29 +8,33 @@ pgsql --CLEAN-- --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/pg_select_001.phpt b/ext/pgsql/tests/pg_select_001.phpt index e31dad28733af..984bf6ceaa92b 100644 --- a/ext/pgsql/tests/pg_select_001.phpt +++ b/ext/pgsql/tests/pg_select_001.phpt @@ -8,49 +8,50 @@ pgsql 1))); /* Existent column */ -var_dump(pg_select($conn, 'phptests.foo', array('id' => 1))); +var_dump(pg_select($conn, "{$schema_name}.foo", array('id' => 1))); /* Testing with inexistent column */ -var_dump(pg_select($conn, 'phptests.bar', array('id' => 1))); +var_dump(pg_select($conn, "{$schema_name}.bar", array('id' => 1))); /* Existent column */ -var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4))); +var_dump(pg_select($conn, "{$schema_name}.bar", array('id4' => 4))); /* Use a different result type */ -var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4), 0, PGSQL_NUM)); +var_dump(pg_select($conn, "{$schema_name}.bar", array('id4' => 4), 0, PGSQL_NUM)); /* Empty array */ -var_dump(pg_select($conn, 'phptests.bar', array())); +var_dump(pg_select($conn, "{$schema_name}.bar", array())); /* No array */ -var_dump(pg_select($conn, 'phptests.bar')); +var_dump(pg_select($conn, "{$schema_name}.bar")); ?> --CLEAN-- --EXPECTF-- Warning: pg_select(): Table 'foo' doesn't exists in %s on line %d diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt index fe359e3d2c277..b42ca6c87b59f 100644 --- a/ext/pgsql/tests/pg_update_001.phpt +++ b/ext/pgsql/tests/pg_update_001.phpt @@ -8,25 +8,27 @@ pgsql 1, 'id2' => 1)); -pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 1)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 2)); -pg_update($conn, 'foo', array('id' => 10), array('id' => 1)); -var_dump(pg_update($conn, 'foo', array('id' => 10), array('id' => 1), PGSQL_DML_STRING)); +pg_update($conn, $table_name, array('id' => 10), array('id' => 1)); +var_dump(pg_update($conn, $table_name, array('id' => 10), array('id' => 1), PGSQL_DML_STRING)); -pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2)); -var_dump(pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2), PGSQL_DML_STRING)); +pg_update($conn, "{$schema_name}.{$table_name}", array('id' => 100), array('id2' => 2)); +var_dump(pg_update($conn, "{$schema_name}.{$table_name}", array('id' => 100), array('id2' => 2), PGSQL_DML_STRING)); -$rs = pg_query($conn, 'SELECT * FROM foo UNION SELECT * FROM phptests.foo ORDER BY id'); +$rs = pg_query($conn, "SELECT * FROM {$table_name} UNION SELECT * FROM {$schema_name}.{$table_name} ORDER BY id"); while ($row = pg_fetch_assoc($rs)) { var_dump($row); } @@ -35,15 +37,18 @@ while ($row = pg_fetch_assoc($rs)) { --CLEAN-- --EXPECT-- -string(38) "UPDATE "foo" SET "id"=10 WHERE "id"=1;" -string(51) "UPDATE "phptests"."foo" SET "id"=100 WHERE "id2"=2;" +string(54) "UPDATE "table_pg_update_001" SET "id"=10 WHERE "id"=1;" +string(79) "UPDATE "schema_pg_update_001"."table_pg_update_001" SET "id"=100 WHERE "id2"=2;" array(2) { ["id"]=> string(2) "10" From 6918e6ff2af5caf8b2c01dfb2264a885399fbf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Sun, 5 Nov 2023 10:20:22 +0900 Subject: [PATCH 06/17] fix(ext/pgsql/tests): typo --- ext/pgsql/tests/bug37100_9.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pgsql/tests/bug37100_9.phpt b/ext/pgsql/tests/bug37100_9.phpt index 6b79cd9290f30..edc1978474d9d 100644 --- a/ext/pgsql/tests/bug37100_9.phpt +++ b/ext/pgsql/tests/bug37100_9.phpt @@ -11,7 +11,7 @@ skip_bytea_not_hex(); Date: Sun, 5 Nov 2023 11:25:45 +0900 Subject: [PATCH 07/17] fix(ext/pgsql/tests): Unify SQL Keywords to uppercase letters --- ext/pgsql/tests/01createdb.phpt | 4 +-- ext/pgsql/tests/03sync_query.phpt | 6 ++-- ext/pgsql/tests/04async_query.phpt | 6 ++-- ext/pgsql/tests/05large_object.phpt | 32 +++++++++---------- ext/pgsql/tests/06_bug73498.phpt | 12 +++---- ext/pgsql/tests/06copy.phpt | 4 +-- ext/pgsql/tests/08escape.phpt | 4 +-- ext/pgsql/tests/10pg_convert_9.phpt | 4 +-- ext/pgsql/tests/10pg_convert_json_array.phpt | 4 +-- ext/pgsql/tests/11pg_meta_data.phpt | 4 +-- ext/pgsql/tests/12pg_insert_9.phpt | 4 +-- ext/pgsql/tests/13pg_select_9.phpt | 8 ++--- ext/pgsql/tests/14pg_update_9.phpt | 8 ++--- ext/pgsql/tests/15pg_delete.phpt | 8 ++--- ext/pgsql/tests/16pg_result_status.phpt | 4 +-- ext/pgsql/tests/17result.phpt | 8 ++--- ext/pgsql/tests/18pg_escape_bytea_before.phpt | 4 +-- ext/pgsql/tests/18pg_escape_bytea_esc.phpt | 4 +-- ext/pgsql/tests/18pg_escape_bytea_hex.phpt | 4 +-- ext/pgsql/tests/22pg_fetch_object.phpt | 6 ++-- ext/pgsql/tests/23sync_query_params.phpt | 6 ++-- ext/pgsql/tests/24sync_query_prepared.phpt | 6 ++-- ext/pgsql/tests/25async_query_params.phpt | 6 ++-- ext/pgsql/tests/26async_query_prepared.phpt | 6 ++-- ext/pgsql/tests/27large_object_oid.phpt | 12 +++---- .../tests/28large_object_import_oid.phpt | 12 +++---- ext/pgsql/tests/30nb_async_query_params.phpt | 6 ++-- .../tests/31nb_async_query_prepared.phpt | 6 ++-- ext/pgsql/tests/32nb_async_query.phpt | 6 ++-- ext/pgsql/tests/80_bug36625.phpt | 4 +-- ext/pgsql/tests/98old_api.phpt | 6 ++-- ext/pgsql/tests/9999dropdb.phpt | 6 ++-- ext/pgsql/tests/bug60244.phpt | 2 +- ext/pgsql/tests/bug65119.phpt | 4 +-- ext/pgsql/tests/pg_pipeline_sync.phpt | 2 +- ext/pgsql/tests/pg_trace.phpt | 2 +- 36 files changed, 115 insertions(+), 115 deletions(-) diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt index 366f3729c309d..94d2f9f46b2e7 100644 --- a/ext/pgsql/tests/01createdb.phpt +++ b/ext/pgsql/tests/01createdb.phpt @@ -45,8 +45,8 @@ $table_name = 'table_01createdb'; $table_name_92 = 'table_01createdb_92'; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name} cascade"); -pg_query($db, "drop table if exists {$table_name_92} cascade"); +pg_query($db, "DROP TABLE {$table_name} cascade"); +pg_query($db, "DROP TABLE if exists {$table_name_92} cascade"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt index e1b37eb7b3c33..a9a0697d5abb3 100644 --- a/ext/pgsql/tests/03sync_query.phpt +++ b/ext/pgsql/tests/03sync_query.phpt @@ -11,8 +11,8 @@ include('inc/config.inc'); $table_name = "table_03sync_query"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} default values"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} DEFAULT VALUES"); $result = pg_query($db, "SELECT * FROM ".$table_name.";"); if (!($rows = pg_num_rows($result))) @@ -143,7 +143,7 @@ include('inc/config.inc'); $table_name = "table_03sync_query"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- Argument #3 must be greater than or equal to 0 diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt index 43a1123c5d4dc..cacbabe24090a 100644 --- a/ext/pgsql/tests/04async_query.phpt +++ b/ext/pgsql/tests/04async_query.phpt @@ -11,8 +11,8 @@ include('inc/config.inc'); $table_name = "table_04async_query"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} default values"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} DEFAULT VALUES"); if (!pg_send_query($db, "SELECT * FROM ".$table_name.";")) { echo "pg_send_query() error\n"; @@ -72,7 +72,7 @@ include('inc/config.inc'); $table_name = "table_04async_query"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/05large_object.phpt b/ext/pgsql/tests/05large_object.phpt index a35f3853d4f6f..a785b76a572d3 100644 --- a/ext/pgsql/tests/05large_object.phpt +++ b/ext/pgsql/tests/05large_object.phpt @@ -12,17 +12,17 @@ include('inc/config.inc'); $db = pg_connect($conn_str); echo "create/write/close LO\n"; -pg_exec ($db, "begin"); +pg_exec ($db, "BEGIN"); $oid = pg_lo_create ($db); if (!$oid) echo ("pg_lo_create() error\n"); $handle = pg_lo_open ($db, $oid, "w"); if (!$handle) echo ("pg_lo_open() error\n"); pg_lo_write ($handle, "large object data"); pg_lo_close ($handle); -pg_exec ($db, "commit"); +pg_exec ($db, "COMMIT"); echo "open/read/tell/seek/close LO\n"; -pg_exec ($db, "begin"); +pg_exec ($db, "BEGIN"); $handle = pg_lo_open ($db, $oid, "w"); var_dump(pg_lo_read($handle, 5)); var_dump(pg_lo_tell($handle)); @@ -34,10 +34,10 @@ var_dump(pg_lo_read($handle)); var_dump(pg_lo_seek($handle, -4, PGSQL_SEEK_END)); /* Seek from the end */ var_dump(pg_lo_read($handle)); pg_lo_close($handle); -pg_exec ($db, "commit"); +pg_exec ($db, "COMMIT"); echo "open/read_all/close LO\n"; -pg_exec ($db, "begin"); +pg_exec ($db, "BEGIN"); $handle = pg_lo_open ($db, $oid, "w"); /* Will write to stdout */ $bytesWritten = pg_lo_read_all($handle); @@ -45,39 +45,39 @@ echo "\n"; var_dump($bytesWritten); if (pg_last_error($db)) echo "pg_lo_read_all() error\n".pg_last_error(); pg_lo_close($handle); -pg_exec ($db, "commit"); +pg_exec ($db, "COMMIT"); echo "unlink LO\n"; -pg_exec ($db, "begin"); +pg_exec ($db, "BEGIN"); pg_lo_unlink($db, $oid) or print("pg_lo_unlink() error 1\n"); -pg_exec ($db, "commit"); +pg_exec ($db, "COMMIT"); // more pg_lo_unlink() tests echo "Test without connection\n"; -pg_exec ($db, "begin"); +pg_exec ($db, "BEGIN"); $oid = pg_lo_create ($db) or print("pg_lo_create() error\n"); pg_lo_unlink($oid) or print("pg_lo_unlink() error 2\n"); -pg_exec ($db, "commit"); +pg_exec ($db, "COMMIT"); echo "Test with string oid value\n"; -pg_exec ($db, "begin"); +pg_exec ($db, "BEGIN"); $oid = pg_lo_create ($db) or print("pg_lo_create() error\n"); pg_lo_unlink($db, (string)$oid) or print("pg_lo_unlink() error 3\n"); -pg_exec ($db, "commit"); +pg_exec ($db, "COMMIT"); echo "import/export LO\n"; $path = __DIR__ . '/'; -pg_query($db, 'begin'); +pg_query($db, 'BEGIN'); $oid = pg_lo_import($db, $path . 'php.gif'); -pg_query($db, 'commit'); -pg_query($db, 'begin'); +pg_query($db, 'COMMIT'); +pg_query($db, 'BEGIN'); @unlink($path . 'php.gif.exported'); pg_lo_export($db, $oid, $path . 'php.gif.exported'); if (!file_exists($path . 'php.gif.exported')) { echo "Export failed\n"; } @unlink($path . 'php.gif.exported'); -pg_query($db, 'commit'); +pg_query($db, 'COMMIT'); /* invalid OID values */ try { diff --git a/ext/pgsql/tests/06_bug73498.phpt b/ext/pgsql/tests/06_bug73498.phpt index 8a20b77d75ed0..90c616258d796 100644 --- a/ext/pgsql/tests/06_bug73498.phpt +++ b/ext/pgsql/tests/06_bug73498.phpt @@ -12,11 +12,11 @@ $table_name = "table_06_bug73498"; $view_name = "view_06_bug73498"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "create view {$view_name} as select * from {$table_name}"); -pg_query($db, "insert into {$table_name} default values"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE VIEW {$view_name} as SELECT * FROM {$table_name}"); +pg_query($db, "INSERT INTO {$table_name} DEFAULT VALUES"); -$rows = pg_copy_to($db, "(select * from {$view_name})"); +$rows = pg_copy_to($db, "(SELECT * FROM {$view_name})"); var_dump(gettype($rows)); var_dump(count($rows) > 0); @@ -29,8 +29,8 @@ $table_name = "table_06_bug73498"; $view_name = "view_06_bug73498"; $db = pg_connect($conn_str); -pg_query($db, "drop view {$view_name}"); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP VIEW {$view_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- string(5) "array" diff --git a/ext/pgsql/tests/06copy.phpt b/ext/pgsql/tests/06copy.phpt index aeb518b0fc864..b5afa3ce4b4fc 100644 --- a/ext/pgsql/tests/06copy.phpt +++ b/ext/pgsql/tests/06copy.phpt @@ -11,7 +11,7 @@ include('inc/config.inc'); $table_name = "table_06copy"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); $rows = pg_copy_to($db, $table_name); @@ -28,7 +28,7 @@ include('inc/config.inc'); $table_name = "table_06copy"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt index 0a6979af48e2e..c284bccfaa33a 100644 --- a/ext/pgsql/tests/08escape.phpt +++ b/ext/pgsql/tests/08escape.phpt @@ -44,7 +44,7 @@ else { // Test using database $data = file_get_contents(FILE_NAME); $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); // Insert binary to DB $escaped_data = pg_escape_bytea($db, $data); @@ -107,7 +107,7 @@ include('inc/config.inc'); $table_name = "table_08escape"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECTF-- Deprecated: pg_escape_string(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d diff --git a/ext/pgsql/tests/10pg_convert_9.phpt b/ext/pgsql/tests/10pg_convert_9.phpt index 577d2cc20468b..e579dd758f007 100644 --- a/ext/pgsql/tests/10pg_convert_9.phpt +++ b/ext/pgsql/tests/10pg_convert_9.phpt @@ -15,7 +15,7 @@ include 'inc/config.inc'; $table_name = "table_10pg_convert_9"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); pg_query($db, "SET standard_conforming_strings = 0"); @@ -58,7 +58,7 @@ include('inc/config.inc'); $table_name = "table_10pg_convert_9"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- array(3) { diff --git a/ext/pgsql/tests/10pg_convert_json_array.phpt b/ext/pgsql/tests/10pg_convert_json_array.phpt index df032980c462d..a94a38bcf6fc7 100644 --- a/ext/pgsql/tests/10pg_convert_json_array.phpt +++ b/ext/pgsql/tests/10pg_convert_json_array.phpt @@ -15,7 +15,7 @@ include 'inc/config.inc'; $table_name_92 = "table_10pg_convert_json_array_92"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name_92} (textary text[], jsn json)"); +pg_query($db, "CREATE TABLE {$table_name_92} (textary text[], jsn json)"); $fields = array( 'textary'=>'{"meeting", "lunch", "training", "presentation"}', @@ -37,7 +37,7 @@ include('inc/config.inc'); $table_name_92 = "table_10pg_convert_json_array_92"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name_92}"); +pg_query($db, "DROP TABLE {$table_name_92}"); ?> --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/11pg_meta_data.phpt b/ext/pgsql/tests/11pg_meta_data.phpt index d01f6719abbb3..c362d4d68c13a 100644 --- a/ext/pgsql/tests/11pg_meta_data.phpt +++ b/ext/pgsql/tests/11pg_meta_data.phpt @@ -12,7 +12,7 @@ include 'inc/config.inc'; $table_name = "table_11pg_meta_data"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); $meta = pg_meta_data($db, $table_name); @@ -24,7 +24,7 @@ include('inc/config.inc'); $table_name = "table_11pg_meta_data"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- array(3) { diff --git a/ext/pgsql/tests/12pg_insert_9.phpt b/ext/pgsql/tests/12pg_insert_9.phpt index a51d9a8eaae5e..49170fef07d67 100644 --- a/ext/pgsql/tests/12pg_insert_9.phpt +++ b/ext/pgsql/tests/12pg_insert_9.phpt @@ -15,7 +15,7 @@ include 'inc/config.inc'; $table_name = "table_12pg_insert_9"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); pg_query($db, "SET standard_conforming_strings = 0"); @@ -62,7 +62,7 @@ include('inc/config.inc'); $table_name = "table_12pg_insert_9"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECTF-- INSERT INTO "table_12pg_insert_9" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242'); diff --git a/ext/pgsql/tests/13pg_select_9.phpt b/ext/pgsql/tests/13pg_select_9.phpt index 771bd1f3e5bd7..02937ddf90020 100644 --- a/ext/pgsql/tests/13pg_select_9.phpt +++ b/ext/pgsql/tests/13pg_select_9.phpt @@ -15,9 +15,9 @@ include 'inc/config.inc'; $table_name = "table_13pg_select_9"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} values(1234, 'AAA', 'BBB')"); -pg_query($db, "insert into {$table_name} values(1234, 'AAA', 'BBB')"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} VALUES(1234, 'AAA', 'BBB')"); +pg_query($db, "INSERT INTO {$table_name} VALUES(1234, 'AAA', 'BBB')"); pg_query($db, "SET bytea_output = 'hex'"); @@ -65,7 +65,7 @@ include('inc/config.inc'); $table_name = "table_13pg_select_9"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/14pg_update_9.phpt b/ext/pgsql/tests/14pg_update_9.phpt index 4f3066268f634..66669ebd0bd8d 100644 --- a/ext/pgsql/tests/14pg_update_9.phpt +++ b/ext/pgsql/tests/14pg_update_9.phpt @@ -15,9 +15,9 @@ include 'inc/config.inc'; $table_name = "table_14pg_update_9"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); -pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} VALUES(1, 'ABC', null)"); +pg_query($db, "INSERT INTO {$table_name} VALUES(1, 'ABC', null)"); pg_query($db, "SET standard_conforming_strings = 0"); @@ -36,7 +36,7 @@ include('inc/config.inc'); $table_name = "table_14pg_update_9"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- UPDATE "table_14pg_update_9" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234; diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt index 90ab8f625068d..00f84a1caaa8d 100644 --- a/ext/pgsql/tests/15pg_delete.phpt +++ b/ext/pgsql/tests/15pg_delete.phpt @@ -12,9 +12,9 @@ include 'inc/config.inc'; $table_name = "table_15pg_delete"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); -pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} VALUES(1, 'ABC', null)"); +pg_query($db, "INSERT INTO {$table_name} VALUES(1, 'ABC', null)"); $fields = array('num'=>'1234', 'str'=>'XXX', 'bin'=>'YYY'); $ids = array('num'=>'1234'); @@ -33,7 +33,7 @@ include('inc/config.inc'); $table_name = "table_15pg_delete"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- DELETE FROM "table_15pg_delete" WHERE "num"=1234; diff --git a/ext/pgsql/tests/16pg_result_status.phpt b/ext/pgsql/tests/16pg_result_status.phpt index aff43094b4ed0..ef555b3e5118a 100644 --- a/ext/pgsql/tests/16pg_result_status.phpt +++ b/ext/pgsql/tests/16pg_result_status.phpt @@ -10,7 +10,7 @@ include 'inc/config.inc'; $table_name = "table_16pg_result_status"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); $sql = "SELECT * FROM ".$table_name." WHERE num = -2"; $result = pg_query($db, "BEGIN;END"); @@ -24,7 +24,7 @@ include('inc/config.inc'); $table_name = "table_16pg_result_status"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- 1 diff --git a/ext/pgsql/tests/17result.phpt b/ext/pgsql/tests/17result.phpt index 74e839ee5c744..345cc1e273147 100644 --- a/ext/pgsql/tests/17result.phpt +++ b/ext/pgsql/tests/17result.phpt @@ -12,9 +12,9 @@ include 'inc/config.inc'; $table_name = "table_17result"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); -pg_query($db, "insert into {$table_name} values(1, 'ABC', null)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} VALUES(1, 'ABC', null)"); +pg_query($db, "INSERT INTO {$table_name} VALUES(1, 'ABC', null)"); $sql = "SELECT * FROM $table_name ORDER BY num"; $result = pg_query($db, $sql) or die('Cannot query db'); @@ -35,7 +35,7 @@ include('inc/config.inc'); $table_name = "table_17result"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECTF-- bool(true) diff --git a/ext/pgsql/tests/18pg_escape_bytea_before.phpt b/ext/pgsql/tests/18pg_escape_bytea_before.phpt index 85b8390dfcaed..5d0682e5999cc 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_before.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_before.phpt @@ -15,7 +15,7 @@ $image = file_get_contents(__DIR__ . '/php.gif'); $esc_image = pg_escape_bytea($image); $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); @pg_query($db, "SET bytea_output = 'escape'"); @@ -37,7 +37,7 @@ include('inc/config.inc'); $table_name = "table_18pg_escape_bytea_before"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECTF-- Deprecated: pg_escape_bytea(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d diff --git a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt index 9f76ce8696ad3..9cb2c53c54109 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt @@ -12,7 +12,7 @@ include('inc/config.inc'); $table_name = "table_18pg_escape_bytea_esc"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); @pg_query($db, "SET bytea_output = 'escape'"); @@ -37,7 +37,7 @@ include('inc/config.inc'); $table_name = "table_18pg_escape_bytea_esc"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt index e0002697ce348..63cee8bf40e8b 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt @@ -15,7 +15,7 @@ include('inc/config.inc'); $table_name = "table_18pg_escape_bytea_hex"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); @pg_query($db, "SET bytea_output = 'hex'"); @@ -40,7 +40,7 @@ include('inc/config.inc'); $table_name = "table_18pg_escape_bytea_hex"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/22pg_fetch_object.phpt b/ext/pgsql/tests/22pg_fetch_object.phpt index 4997745832887..cb5420bbafde2 100644 --- a/ext/pgsql/tests/22pg_fetch_object.phpt +++ b/ext/pgsql/tests/22pg_fetch_object.phpt @@ -18,8 +18,8 @@ class test_class { } $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} values(0, 'ABC', null)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} VALUES(0, 'ABC', null)"); $sql = "SELECT * FROM $table_name WHERE num = 0"; $result = pg_query($db, $sql) or die('Cannot query db'); @@ -41,7 +41,7 @@ include('inc/config.inc'); $table_name = "table_22pg_fetch_object"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECTF-- test_class::__construct(1,2) diff --git a/ext/pgsql/tests/23sync_query_params.phpt b/ext/pgsql/tests/23sync_query_params.phpt index 64cba52248e9d..4a0eda138cd6b 100644 --- a/ext/pgsql/tests/23sync_query_params.phpt +++ b/ext/pgsql/tests/23sync_query_params.phpt @@ -14,8 +14,8 @@ include('inc/config.inc'); $table_name = "table_23sync_query_params"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} (num) values(1000)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} (num) VALUES(1000)"); $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)); if (!($rows = pg_num_rows($result))) @@ -63,7 +63,7 @@ include('inc/config.inc'); $table_name = "table_23sync_query_params"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt index bdd8264a87900..82155a1b35987 100644 --- a/ext/pgsql/tests/24sync_query_prepared.phpt +++ b/ext/pgsql/tests/24sync_query_prepared.phpt @@ -14,8 +14,8 @@ include('inc/config.inc'); $table_name = "table_24sync_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} (num) values(1000)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} (num) VALUES(1000)"); $result = pg_prepare($db, "php_test", "SELECT * FROM ".$table_name." WHERE num > \$1;"); pg_result_error($result); @@ -69,7 +69,7 @@ include('inc/config.inc'); $table_name = "table_24sync_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt index a7019f7d235ff..c1cd9d88d85bc 100644 --- a/ext/pgsql/tests/25async_query_params.phpt +++ b/ext/pgsql/tests/25async_query_params.phpt @@ -14,8 +14,8 @@ include('inc/config.inc'); $table_name = "table_25async_query_params"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} (num) values(1000)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} (num) VALUES(1000)"); if (!pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))) { echo "pg_send_query_params() error\n"; @@ -74,7 +74,7 @@ include('inc/config.inc'); $table_name = "table_25async_query_params"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt index fcec2319eafaa..e7dc4943cbdb2 100644 --- a/ext/pgsql/tests/26async_query_prepared.phpt +++ b/ext/pgsql/tests/26async_query_prepared.phpt @@ -14,8 +14,8 @@ include('inc/config.inc'); $table_name = "table_26async_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} (num) values(1000)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} (num) VALUES(1000)"); if (!pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;")) { echo "pg_send_prepare() error\n"; @@ -110,7 +110,7 @@ include('inc/config.inc'); $table_name = "table_26async_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/27large_object_oid.phpt b/ext/pgsql/tests/27large_object_oid.phpt index 1026786164dc2..079c29608c3b7 100644 --- a/ext/pgsql/tests/27large_object_oid.phpt +++ b/ext/pgsql/tests/27large_object_oid.phpt @@ -17,28 +17,28 @@ include('inc/config.inc'); $db = pg_connect($conn_str); echo "create LO from int\n"; -pg_exec ($db, "begin"); +pg_exec ($db, "BEGIN"); $oid = pg_lo_create ($db, 21000); if (!$oid) echo ("pg_lo_create() error\n"); if ($oid != 21000) echo ("pg_lo_create() wrong id\n"); pg_lo_unlink ($db, $oid); -pg_exec ($db, "commit"); +pg_exec ($db, "COMMIT"); echo "create LO from string\n"; -pg_exec ($db, "begin"); +pg_exec ($db, "BEGIN"); $oid = pg_lo_create ($db, "21001"); if (!$oid) echo ("pg_lo_create() error\n"); if ($oid != 21001) echo ("pg_lo_create() wrong id\n"); pg_lo_unlink ($db, $oid); -pg_exec ($db, "commit"); +pg_exec ($db, "COMMIT"); echo "create LO using default connection\n"; -pg_exec ("begin"); +pg_exec ("BEGIN"); $oid = pg_lo_create (21002); if (!$oid) echo ("pg_lo_create() error\n"); if ($oid != 21002) echo ("pg_lo_create() wrong id\n"); pg_lo_unlink ($oid); -pg_exec ("commit"); +pg_exec ("COMMIT"); echo "OK"; ?> diff --git a/ext/pgsql/tests/28large_object_import_oid.phpt b/ext/pgsql/tests/28large_object_import_oid.phpt index 94eb3beddd9c9..6449a2b00f7fe 100644 --- a/ext/pgsql/tests/28large_object_import_oid.phpt +++ b/ext/pgsql/tests/28large_object_import_oid.phpt @@ -17,28 +17,28 @@ include('inc/config.inc'); $db = pg_connect($conn_str); echo "import LO from int\n"; -pg_exec($db, 'begin'); +pg_exec($db, 'BEGIN'); $oid = pg_lo_import($db, __FILE__, 21003); if (!$oid) echo ("pg_lo_import() error\n"); if ($oid != 21003) echo ("pg_lo_import() wrong id\n"); pg_lo_unlink ($db, $oid); -pg_exec($db, 'commit'); +pg_exec($db, 'COMMIT'); echo "import LO from string\n"; -pg_exec($db, 'begin'); +pg_exec($db, 'BEGIN'); $oid = pg_lo_import($db, __FILE__, "21004"); if (!$oid) echo ("pg_lo_import() error\n"); if ($oid != 21004) echo ("pg_lo_import() wrong id\n"); pg_lo_unlink ($db, $oid); -pg_exec($db, 'commit'); +pg_exec($db, 'COMMIT'); echo "import LO using default connection\n"; -pg_exec('begin'); +pg_exec('BEGIN'); $oid = pg_lo_import($db, __FILE__, 21005); if (!$oid) echo ("pg_lo_import() error\n"); if ($oid != 21005) echo ("pg_lo_import() wrong id\n"); pg_lo_unlink ($oid); -pg_exec('commit'); +pg_exec('COMMIT'); /* Invalide OID */ try { diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt index f54761fdbf60e..16589f8fcb782 100644 --- a/ext/pgsql/tests/30nb_async_query_params.phpt +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -15,8 +15,8 @@ include('inc/nonblocking.inc'); $table_name = "table_30nb_async_query_params"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} (num) values(1000)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} (num) VALUES(1000)"); $db_socket = pg_socket($db); stream_set_blocking($db_socket, false); @@ -79,7 +79,7 @@ include('inc/config.inc'); $table_name = "table_30nb_async_query_params"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt index 40e1da5731237..25d6b8feebca6 100644 --- a/ext/pgsql/tests/31nb_async_query_prepared.phpt +++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt @@ -15,8 +15,8 @@ include('inc/nonblocking.inc'); $table_name = "table_31nb_async_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} (num) values(1000)"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} (num) VALUES(1000)"); $db_socket = pg_socket($db); stream_set_blocking($db_socket, false); @@ -112,7 +112,7 @@ include('inc/config.inc'); $table_name = "table_31nb_async_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt index 6f529bb817441..7ba4955d7ad18 100644 --- a/ext/pgsql/tests/32nb_async_query.phpt +++ b/ext/pgsql/tests/32nb_async_query.phpt @@ -15,8 +15,8 @@ include('inc/nonblocking.inc'); $table_name = "table_32nb_async_query"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} default values"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} DEFAULT VALUES"); $db_socket = pg_socket($db); stream_set_blocking($db_socket, false); @@ -84,7 +84,7 @@ include('inc/config.inc'); $table_name = "table_32nb_async_query"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/80_bug36625.phpt b/ext/pgsql/tests/80_bug36625.phpt index 0fb2dea2f0204..ad1191ec75b54 100644 --- a/ext/pgsql/tests/80_bug36625.phpt +++ b/ext/pgsql/tests/80_bug36625.phpt @@ -22,14 +22,14 @@ $tracefile = __DIR__ . '/trace.tmp'; var_dump(file_exists($tracefile)); pg_trace($tracefile, 'w', $dbh); -$res = pg_query($dbh, 'select 1'); +$res = pg_query($dbh, 'SELECT 1'); var_dump($res); pg_close($dbh); $found = 0; function search_trace_file($line) { - if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) { + if (strpos($line, '"SELECT 1"') !== false || strpos($line, "'SELECT 1'") !== false) { $GLOBALS['found']++; } } diff --git a/ext/pgsql/tests/98old_api.phpt b/ext/pgsql/tests/98old_api.phpt index 5819c70788add..37acc2c3a874f 100644 --- a/ext/pgsql/tests/98old_api.phpt +++ b/ext/pgsql/tests/98old_api.phpt @@ -11,8 +11,8 @@ include('inc/config.inc'); $table_name = "table_98old_api"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "insert into {$table_name} default values"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "INSERT INTO {$table_name} DEFAULT VALUES"); $result = pg_exec($db, "SELECT * FROM ".$table_name); pg_numrows($result); @@ -42,7 +42,7 @@ include('inc/config.inc'); $table_name = "table_98old_api"; $db = pg_connect($conn_str); -pg_query($db, "drop table {$table_name}"); +pg_query($db, "DROP TABLE {$table_name}"); ?> --EXPECTF-- Deprecated: Function pg_numrows() is deprecated in %s on line %d diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt index 63f9d4e324bec..c6af98c016b92 100644 --- a/ext/pgsql/tests/9999dropdb.phpt +++ b/ext/pgsql/tests/9999dropdb.phpt @@ -14,9 +14,9 @@ $table_name_92 = "table_9999dropdb_92"; $view_name = "view_9999dropdb"; $db = pg_connect($conn_str); -pg_query($db, "create table {$table_name} (num int, str text, bin bytea)"); -pg_query($db, "create table {$table_name_92} (textary text[], jsn json)"); -pg_query($db, "create view {$view_name} as select * from {$table_name}"); +pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); +pg_query($db, "CREATE TABLE {$table_name_92} (textary text[], jsn json)"); +pg_query($db, "CREATE VIEW {$view_name} as SELECT * FROM {$table_name}"); pg_query($db, "DROP VIEW {$view_name}"); pg_query($db, "DROP TABLE ".$table_name); diff --git a/ext/pgsql/tests/bug60244.phpt b/ext/pgsql/tests/bug60244.phpt index 042ba0d75d9b1..e162be644af5b 100644 --- a/ext/pgsql/tests/bug60244.phpt +++ b/ext/pgsql/tests/bug60244.phpt @@ -12,7 +12,7 @@ include("inc/skipif.inc"); include 'inc/config.inc'; $db = pg_connect($conn_str); -$result = pg_query($db, "select 'a' union select 'b'"); +$result = pg_query($db, "SELECT 'a' UNION SELECT 'b'"); try { var_dump(pg_fetch_array($result, -1)); diff --git a/ext/pgsql/tests/bug65119.phpt b/ext/pgsql/tests/bug65119.phpt index 530162db2dbc1..64b60d34684cc 100644 --- a/ext/pgsql/tests/bug65119.phpt +++ b/ext/pgsql/tests/bug65119.phpt @@ -14,10 +14,10 @@ $table_name = 'table_bug65119'; function test(Array $values, $conn_str) { global $table_name; $connection = pg_pconnect($conn_str, PGSQL_CONNECT_FORCE_NEW); - pg_query($connection, "begin"); + pg_query($connection, "BEGIN"); pg_query($connection, "CREATE TABLE {$table_name} (i INTEGER)"); pg_copy_from($connection, $table_name, $values, "\t", "NULL"); - pg_query($connection, "rollback"); + pg_query($connection, "ROLLBACK"); } $values = Array(1,2,3); diff --git a/ext/pgsql/tests/pg_pipeline_sync.phpt b/ext/pgsql/tests/pg_pipeline_sync.phpt index 6bb1c2d4fe41a..96dc7e613f9b8 100644 --- a/ext/pgsql/tests/pg_pipeline_sync.phpt +++ b/ext/pgsql/tests/pg_pipeline_sync.phpt @@ -46,7 +46,7 @@ if (!pg_enter_pipeline_mode($db)) { die('pg_enter_pipeline_mode{}'); } -if (!pg_send_query_params($db, "select $1 as index, now() + ($1||' day')::interval as time", array(1))) { +if (!pg_send_query_params($db, "SELECT $1 as index, now() + ($1||' day')::interval as time", array(1))) { die('pg_send_query_params failed'); } diff --git a/ext/pgsql/tests/pg_trace.phpt b/ext/pgsql/tests/pg_trace.phpt index 47e073a26ffa3..9caf1d2ed935d 100644 --- a/ext/pgsql/tests/pg_trace.phpt +++ b/ext/pgsql/tests/pg_trace.phpt @@ -18,7 +18,7 @@ try { echo $e->getMessage() . PHP_EOL; } var_dump(pg_trace($tracefile, 'w', $db, 0)); -$res = pg_query($db, 'select 1'); +$res = pg_query($db, 'SELECT 1'); ?> --EXPECTF-- From 8a3484888dce8530ada1c4c698a1923f180020ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Sun, 5 Nov 2023 12:27:43 +0900 Subject: [PATCH 08/17] fix(ext/pgsql/tests): behavior when `--CLEAN--` is executed while object creation fails --- ext/pgsql/tests/01createdb.phpt | 2 +- ext/pgsql/tests/03sync_query.phpt | 2 +- ext/pgsql/tests/04async_query.phpt | 2 +- ext/pgsql/tests/06_bug73498.phpt | 4 ++-- ext/pgsql/tests/06copy.phpt | 2 +- ext/pgsql/tests/06copy_2.phpt | 2 +- ext/pgsql/tests/08escape.phpt | 2 +- ext/pgsql/tests/10pg_convert_9.phpt | 2 +- ext/pgsql/tests/10pg_convert_json_array.phpt | 2 +- ext/pgsql/tests/11pg_meta_data.phpt | 2 +- ext/pgsql/tests/12pg_insert_9.phpt | 2 +- ext/pgsql/tests/13pg_select_9.phpt | 2 +- ext/pgsql/tests/14pg_update_9.phpt | 2 +- ext/pgsql/tests/15pg_delete.phpt | 2 +- ext/pgsql/tests/16pg_result_status.phpt | 2 +- ext/pgsql/tests/17result.phpt | 2 +- ext/pgsql/tests/18pg_escape_bytea_before.phpt | 2 +- ext/pgsql/tests/18pg_escape_bytea_esc.phpt | 2 +- ext/pgsql/tests/18pg_escape_bytea_hex.phpt | 2 +- ext/pgsql/tests/22pg_fetch_object.phpt | 2 +- ext/pgsql/tests/23sync_query_params.phpt | 2 +- ext/pgsql/tests/24sync_query_prepared.phpt | 2 +- ext/pgsql/tests/25async_query_params.phpt | 2 +- ext/pgsql/tests/26async_query_prepared.phpt | 2 +- ext/pgsql/tests/30nb_async_query_params.phpt | 2 +- ext/pgsql/tests/31nb_async_query_prepared.phpt | 2 +- ext/pgsql/tests/32nb_async_query.phpt | 2 +- ext/pgsql/tests/80_bug24499.phpt | 2 +- ext/pgsql/tests/80_bug27597.phpt | 2 +- ext/pgsql/tests/80_bug39971.phpt | 2 +- ext/pgsql/tests/80_bug42783.phpt | 2 +- ext/pgsql/tests/98old_api.phpt | 2 +- ext/pgsql/tests/9999dropdb.phpt | 2 +- ext/pgsql/tests/bug37100.phpt | 2 +- ext/pgsql/tests/bug37100_9.phpt | 2 +- ext/pgsql/tests/bug71998.phpt | 2 +- ext/pgsql/tests/pg_delete_001.phpt | 6 +++--- ext/pgsql/tests/pg_insert_001.phpt | 4 ++-- ext/pgsql/tests/pg_meta_data_001.phpt | 6 +++--- ext/pgsql/tests/pg_select_001.phpt | 2 +- ext/pgsql/tests/pg_update_001.phpt | 6 +++--- 41 files changed, 49 insertions(+), 49 deletions(-) diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt index 94d2f9f46b2e7..2d94dab212861 100644 --- a/ext/pgsql/tests/01createdb.phpt +++ b/ext/pgsql/tests/01createdb.phpt @@ -45,7 +45,7 @@ $table_name = 'table_01createdb'; $table_name_92 = 'table_01createdb_92'; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name} cascade"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name} cascade"); pg_query($db, "DROP TABLE if exists {$table_name_92} cascade"); ?> --EXPECT-- diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt index a9a0697d5abb3..2a511502f4a4a 100644 --- a/ext/pgsql/tests/03sync_query.phpt +++ b/ext/pgsql/tests/03sync_query.phpt @@ -143,7 +143,7 @@ include('inc/config.inc'); $table_name = "table_03sync_query"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- Argument #3 must be greater than or equal to 0 diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt index cacbabe24090a..70a5f47c3f270 100644 --- a/ext/pgsql/tests/04async_query.phpt +++ b/ext/pgsql/tests/04async_query.phpt @@ -72,7 +72,7 @@ include('inc/config.inc'); $table_name = "table_04async_query"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/06_bug73498.phpt b/ext/pgsql/tests/06_bug73498.phpt index 90c616258d796..ce989cbc25355 100644 --- a/ext/pgsql/tests/06_bug73498.phpt +++ b/ext/pgsql/tests/06_bug73498.phpt @@ -29,8 +29,8 @@ $table_name = "table_06_bug73498"; $view_name = "view_06_bug73498"; $db = pg_connect($conn_str); -pg_query($db, "DROP VIEW {$view_name}"); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP VIEW IF EXISTS {$view_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- string(5) "array" diff --git a/ext/pgsql/tests/06copy.phpt b/ext/pgsql/tests/06copy.phpt index b5afa3ce4b4fc..e85ae767c5de6 100644 --- a/ext/pgsql/tests/06copy.phpt +++ b/ext/pgsql/tests/06copy.phpt @@ -28,7 +28,7 @@ include('inc/config.inc'); $table_name = "table_06copy"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/06copy_2.phpt b/ext/pgsql/tests/06copy_2.phpt index 306df8cae2eaa..a6ad92cd8d664 100644 --- a/ext/pgsql/tests/06copy_2.phpt +++ b/ext/pgsql/tests/06copy_2.phpt @@ -29,7 +29,7 @@ include('inc/config.inc'); $table_name = 'table_06copy_2'; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt index c284bccfaa33a..2244854aff7f6 100644 --- a/ext/pgsql/tests/08escape.phpt +++ b/ext/pgsql/tests/08escape.phpt @@ -107,7 +107,7 @@ include('inc/config.inc'); $table_name = "table_08escape"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECTF-- Deprecated: pg_escape_string(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d diff --git a/ext/pgsql/tests/10pg_convert_9.phpt b/ext/pgsql/tests/10pg_convert_9.phpt index e579dd758f007..d733b888fe030 100644 --- a/ext/pgsql/tests/10pg_convert_9.phpt +++ b/ext/pgsql/tests/10pg_convert_9.phpt @@ -58,7 +58,7 @@ include('inc/config.inc'); $table_name = "table_10pg_convert_9"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- array(3) { diff --git a/ext/pgsql/tests/10pg_convert_json_array.phpt b/ext/pgsql/tests/10pg_convert_json_array.phpt index a94a38bcf6fc7..d1acc686d8909 100644 --- a/ext/pgsql/tests/10pg_convert_json_array.phpt +++ b/ext/pgsql/tests/10pg_convert_json_array.phpt @@ -37,7 +37,7 @@ include('inc/config.inc'); $table_name_92 = "table_10pg_convert_json_array_92"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name_92}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name_92}"); ?> --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/11pg_meta_data.phpt b/ext/pgsql/tests/11pg_meta_data.phpt index c362d4d68c13a..a1cad68d39212 100644 --- a/ext/pgsql/tests/11pg_meta_data.phpt +++ b/ext/pgsql/tests/11pg_meta_data.phpt @@ -24,7 +24,7 @@ include('inc/config.inc'); $table_name = "table_11pg_meta_data"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- array(3) { diff --git a/ext/pgsql/tests/12pg_insert_9.phpt b/ext/pgsql/tests/12pg_insert_9.phpt index 49170fef07d67..b986d14e15dca 100644 --- a/ext/pgsql/tests/12pg_insert_9.phpt +++ b/ext/pgsql/tests/12pg_insert_9.phpt @@ -62,7 +62,7 @@ include('inc/config.inc'); $table_name = "table_12pg_insert_9"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECTF-- INSERT INTO "table_12pg_insert_9" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242'); diff --git a/ext/pgsql/tests/13pg_select_9.phpt b/ext/pgsql/tests/13pg_select_9.phpt index 02937ddf90020..028215f5d8000 100644 --- a/ext/pgsql/tests/13pg_select_9.phpt +++ b/ext/pgsql/tests/13pg_select_9.phpt @@ -65,7 +65,7 @@ include('inc/config.inc'); $table_name = "table_13pg_select_9"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/14pg_update_9.phpt b/ext/pgsql/tests/14pg_update_9.phpt index 66669ebd0bd8d..602019c2fb621 100644 --- a/ext/pgsql/tests/14pg_update_9.phpt +++ b/ext/pgsql/tests/14pg_update_9.phpt @@ -36,7 +36,7 @@ include('inc/config.inc'); $table_name = "table_14pg_update_9"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- UPDATE "table_14pg_update_9" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234; diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt index 00f84a1caaa8d..206971debf268 100644 --- a/ext/pgsql/tests/15pg_delete.phpt +++ b/ext/pgsql/tests/15pg_delete.phpt @@ -33,7 +33,7 @@ include('inc/config.inc'); $table_name = "table_15pg_delete"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- DELETE FROM "table_15pg_delete" WHERE "num"=1234; diff --git a/ext/pgsql/tests/16pg_result_status.phpt b/ext/pgsql/tests/16pg_result_status.phpt index ef555b3e5118a..318ba707b970e 100644 --- a/ext/pgsql/tests/16pg_result_status.phpt +++ b/ext/pgsql/tests/16pg_result_status.phpt @@ -24,7 +24,7 @@ include('inc/config.inc'); $table_name = "table_16pg_result_status"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- 1 diff --git a/ext/pgsql/tests/17result.phpt b/ext/pgsql/tests/17result.phpt index 345cc1e273147..4025f2605be38 100644 --- a/ext/pgsql/tests/17result.phpt +++ b/ext/pgsql/tests/17result.phpt @@ -35,7 +35,7 @@ include('inc/config.inc'); $table_name = "table_17result"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECTF-- bool(true) diff --git a/ext/pgsql/tests/18pg_escape_bytea_before.phpt b/ext/pgsql/tests/18pg_escape_bytea_before.phpt index 5d0682e5999cc..5c7e755dcaea6 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_before.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_before.phpt @@ -37,7 +37,7 @@ include('inc/config.inc'); $table_name = "table_18pg_escape_bytea_before"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECTF-- Deprecated: pg_escape_bytea(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d diff --git a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt index 9cb2c53c54109..55f6e5d9bc467 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt @@ -37,7 +37,7 @@ include('inc/config.inc'); $table_name = "table_18pg_escape_bytea_esc"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt index 63cee8bf40e8b..eb43c10dc0569 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt @@ -40,7 +40,7 @@ include('inc/config.inc'); $table_name = "table_18pg_escape_bytea_hex"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/22pg_fetch_object.phpt b/ext/pgsql/tests/22pg_fetch_object.phpt index cb5420bbafde2..939a3adb35050 100644 --- a/ext/pgsql/tests/22pg_fetch_object.phpt +++ b/ext/pgsql/tests/22pg_fetch_object.phpt @@ -41,7 +41,7 @@ include('inc/config.inc'); $table_name = "table_22pg_fetch_object"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECTF-- test_class::__construct(1,2) diff --git a/ext/pgsql/tests/23sync_query_params.phpt b/ext/pgsql/tests/23sync_query_params.phpt index 4a0eda138cd6b..a4be57102f656 100644 --- a/ext/pgsql/tests/23sync_query_params.phpt +++ b/ext/pgsql/tests/23sync_query_params.phpt @@ -63,7 +63,7 @@ include('inc/config.inc'); $table_name = "table_23sync_query_params"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt index 82155a1b35987..bafb182827303 100644 --- a/ext/pgsql/tests/24sync_query_prepared.phpt +++ b/ext/pgsql/tests/24sync_query_prepared.phpt @@ -69,7 +69,7 @@ include('inc/config.inc'); $table_name = "table_24sync_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt index c1cd9d88d85bc..26531f991a849 100644 --- a/ext/pgsql/tests/25async_query_params.phpt +++ b/ext/pgsql/tests/25async_query_params.phpt @@ -74,7 +74,7 @@ include('inc/config.inc'); $table_name = "table_25async_query_params"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt index e7dc4943cbdb2..31b53f531a394 100644 --- a/ext/pgsql/tests/26async_query_prepared.phpt +++ b/ext/pgsql/tests/26async_query_prepared.phpt @@ -110,7 +110,7 @@ include('inc/config.inc'); $table_name = "table_26async_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt index 16589f8fcb782..937da93d02b35 100644 --- a/ext/pgsql/tests/30nb_async_query_params.phpt +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -79,7 +79,7 @@ include('inc/config.inc'); $table_name = "table_30nb_async_query_params"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt index 25d6b8feebca6..50161827a9694 100644 --- a/ext/pgsql/tests/31nb_async_query_prepared.phpt +++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt @@ -112,7 +112,7 @@ include('inc/config.inc'); $table_name = "table_31nb_async_query_prepared"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt index 7ba4955d7ad18..0cdac72cf3100 100644 --- a/ext/pgsql/tests/32nb_async_query.phpt +++ b/ext/pgsql/tests/32nb_async_query.phpt @@ -84,7 +84,7 @@ include('inc/config.inc'); $table_name = "table_32nb_async_query"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- OK diff --git a/ext/pgsql/tests/80_bug24499.phpt b/ext/pgsql/tests/80_bug24499.phpt index 757ba00f34cbe..452691d4f6e2f 100644 --- a/ext/pgsql/tests/80_bug24499.phpt +++ b/ext/pgsql/tests/80_bug24499.phpt @@ -55,7 +55,7 @@ require_once('inc/config.inc'); $table_name = 'table_80_bug24499'; $dbh = pg_connect($conn_str); -pg_query($dbh, "DROP TABLE {$table_name} CASCADE"); +pg_query($dbh, "DROP TABLE IF EXISTS {$table_name} CASCADE"); ?> --EXPECTF-- Array diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt index c000ba56cccc3..0c9a2b5b10702 100644 --- a/ext/pgsql/tests/80_bug27597.phpt +++ b/ext/pgsql/tests/80_bug27597.phpt @@ -47,7 +47,7 @@ require_once('inc/config.inc'); $table_name = 'table_80_bug27597'; $dbh = pg_connect($conn_str); -pg_query($dbh, "DROP TABLE {$table_name}"); +pg_query($dbh, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- Array diff --git a/ext/pgsql/tests/80_bug39971.phpt b/ext/pgsql/tests/80_bug39971.phpt index 4858912f81581..8a0d5e7249e31 100644 --- a/ext/pgsql/tests/80_bug39971.phpt +++ b/ext/pgsql/tests/80_bug39971.phpt @@ -31,7 +31,7 @@ require_once('inc/config.inc'); $table_name = 'table_80_bug39971'; $dbh = pg_connect($conn_str); -pg_query($dbh, "DROP TABLE {$table_name}"); +pg_query($dbh, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- ===DONE=== diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt index 775566270acb1..cdce536d87597 100644 --- a/ext/pgsql/tests/80_bug42783.phpt +++ b/ext/pgsql/tests/80_bug42783.phpt @@ -31,7 +31,7 @@ require_once('inc/config.inc'); $table_name = 'table_80_bug42783'; $dbh = pg_connect($conn_str); -pg_query($dbh, "DROP TABLE {$table_name}"); +pg_query($dbh, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECTF-- array(2) { diff --git a/ext/pgsql/tests/98old_api.phpt b/ext/pgsql/tests/98old_api.phpt index 37acc2c3a874f..26bfd6fa5966a 100644 --- a/ext/pgsql/tests/98old_api.phpt +++ b/ext/pgsql/tests/98old_api.phpt @@ -42,7 +42,7 @@ include('inc/config.inc'); $table_name = "table_98old_api"; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECTF-- Deprecated: Function pg_numrows() is deprecated in %s on line %d diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt index c6af98c016b92..9537dd7f19645 100644 --- a/ext/pgsql/tests/9999dropdb.phpt +++ b/ext/pgsql/tests/9999dropdb.phpt @@ -18,7 +18,7 @@ pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); pg_query($db, "CREATE TABLE {$table_name_92} (textary text[], jsn json)"); pg_query($db, "CREATE VIEW {$view_name} as SELECT * FROM {$table_name}"); -pg_query($db, "DROP VIEW {$view_name}"); +pg_query($db, "DROP VIEW IF EXISTS {$view_name}"); pg_query($db, "DROP TABLE ".$table_name); @pg_query($db, "DROP TABLE ".$table_name_92); diff --git a/ext/pgsql/tests/bug37100.phpt b/ext/pgsql/tests/bug37100.phpt index c5977a8530e44..e67fb77bc3317 100644 --- a/ext/pgsql/tests/bug37100.phpt +++ b/ext/pgsql/tests/bug37100.phpt @@ -41,7 +41,7 @@ require_once('inc/config.inc'); $table_name = 'table_bug37100'; $db = pg_connect($conn_str); -pg_query("DROP TABLE {$table_name}"); +pg_query("DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- string(24) "\001\003\252\000\010\022" diff --git a/ext/pgsql/tests/bug37100_9.phpt b/ext/pgsql/tests/bug37100_9.phpt index edc1978474d9d..22db1256d0201 100644 --- a/ext/pgsql/tests/bug37100_9.phpt +++ b/ext/pgsql/tests/bug37100_9.phpt @@ -45,7 +45,7 @@ require_once('inc/config.inc'); $table_name = 'table_bug37100_9'; $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- string(14) "\x0103aa000812" diff --git a/ext/pgsql/tests/bug71998.phpt b/ext/pgsql/tests/bug71998.phpt index 891b98a728070..e54215dadcd75 100644 --- a/ext/pgsql/tests/bug71998.phpt +++ b/ext/pgsql/tests/bug71998.phpt @@ -91,7 +91,7 @@ $table_name = 'table_bug71998'; $db = @pg_connect($conn_str); -pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> --EXPECT-- pg_insert(): Field "remote_addr" must be a valid IPv4 or IPv6 address string, "256.257.258.259" given diff --git a/ext/pgsql/tests/pg_delete_001.phpt b/ext/pgsql/tests/pg_delete_001.phpt index 26b3c4de9e425..726f08f0881c1 100644 --- a/ext/pgsql/tests/pg_delete_001.phpt +++ b/ext/pgsql/tests/pg_delete_001.phpt @@ -52,9 +52,9 @@ $table_name = 'table_pg_delete_001'; $conn = pg_connect($conn_str); -pg_query($conn, "DROP TABLE {$table_name}"); -pg_query($conn, "DROP TABLE {$schema_name}.{$table_name}"); -pg_query($conn, "DROP SCHEMA {$schema_name}"); +pg_query($conn, "DROP TABLE IF EXISTS {$table_name}"); +pg_query($conn, "DROP TABLE IF EXISTS {$schema_name}.{$table_name}"); +pg_query($conn, "DROP SCHEMA IF EXISTS {$schema_name}"); ?> --EXPECTF-- string(59) "DELETE FROM "table_pg_delete_001" WHERE "id"=1 AND "id2"=2;" diff --git a/ext/pgsql/tests/pg_insert_001.phpt b/ext/pgsql/tests/pg_insert_001.phpt index 62835fa546a8a..89f995acc2dd0 100644 --- a/ext/pgsql/tests/pg_insert_001.phpt +++ b/ext/pgsql/tests/pg_insert_001.phpt @@ -33,8 +33,8 @@ $schema_name = 'schema_pg_insert_001'; $table_name = 'table_pg_insert_001'; $conn = pg_connect($conn_str); -pg_query($conn, "DROP TABLE {$schema_name}.{$table_name}"); -pg_query($conn, "DROP SCHEMA {$schema_name}"); +pg_query($conn, "DROP TABLE IF EXISTS {$schema_name}.{$table_name}"); +pg_query($conn, "DROP SCHEMA IF EXISTS {$schema_name}"); ?> --EXPECTF-- Warning: pg_insert(): Table 'table_pg_insert_001' doesn't exists in %s on line %d diff --git a/ext/pgsql/tests/pg_meta_data_001.phpt b/ext/pgsql/tests/pg_meta_data_001.phpt index ed8d79a9d0fff..88fb15b55abfc 100644 --- a/ext/pgsql/tests/pg_meta_data_001.phpt +++ b/ext/pgsql/tests/pg_meta_data_001.phpt @@ -32,9 +32,9 @@ $schema_name = 'schema_pg_meta_data_001'; $table_name = 'table_pg_meta_data_001'; $conn = pg_connect($conn_str); -pg_query($conn, "DROP TABLE {$table_name}"); -pg_query($conn, "DROP TABLE {$schema_name}.{$table_name}"); -pg_query($conn, "DROP SCHEMA {$schema_name}"); +pg_query($conn, "DROP TABLE IF EXISTS {$table_name}"); +pg_query($conn, "DROP TABLE IF EXISTS {$schema_name}.{$table_name}"); +pg_query($conn, "DROP SCHEMA IF EXISTS {$schema_name}"); ?> --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/pg_select_001.phpt b/ext/pgsql/tests/pg_select_001.phpt index 984bf6ceaa92b..bc7ca63cc0813 100644 --- a/ext/pgsql/tests/pg_select_001.phpt +++ b/ext/pgsql/tests/pg_select_001.phpt @@ -51,7 +51,7 @@ $schema_name = 'schema_pg_select_001'; $conn = pg_connect($conn_str); -pg_query($conn, "DROP SCHEMA {$schema_name} CASCADE"); +pg_query($conn, "DROP SCHEMA IF EXISTS {$schema_name} CASCADE"); ?> --EXPECTF-- Warning: pg_select(): Table 'foo' doesn't exists in %s on line %d diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt index b42ca6c87b59f..df03cce7efaf7 100644 --- a/ext/pgsql/tests/pg_update_001.phpt +++ b/ext/pgsql/tests/pg_update_001.phpt @@ -42,9 +42,9 @@ $table_name = 'table_pg_update_001'; $conn = pg_connect($conn_str); -pg_query($conn, "DROP TABLE {$table_name}"); -pg_query($conn, "DROP TABLE {$schema_name}.{$table_name}"); -pg_query($conn, "DROP SCHEMA {$schema_name}"); +pg_query($conn, "DROP TABLE IF EXISTS {$table_name}"); +pg_query($conn, "DROP TABLE IF EXISTS {$schema_name}.{$table_name}"); +pg_query($conn, "DROP SCHEMA IF EXISTS {$schema_name}"); ?> --EXPECT-- string(54) "UPDATE "table_pg_update_001" SET "id"=10 WHERE "id"=1;" From 8188b5c0540c42676e3672ab435389f8f8c6eadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Sun, 5 Nov 2023 13:32:46 +0900 Subject: [PATCH 09/17] epmty(retry flaky test) From 956eac54e995d4328b1cd5bb57e68e96acf62c57 Mon Sep 17 00:00:00 2001 From: KentarouTakeda Date: Mon, 6 Nov 2023 22:18:08 +0900 Subject: [PATCH 10/17] Update ext/pgsql/tests/01createdb.phpt Co-authored-by: Gina Peter Banyard --- ext/pgsql/tests/01createdb.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt index 2d94dab212861..bc70828051cd8 100644 --- a/ext/pgsql/tests/01createdb.phpt +++ b/ext/pgsql/tests/01createdb.phpt @@ -46,7 +46,7 @@ $table_name_92 = 'table_01createdb_92'; $db = pg_connect($conn_str); pg_query($db, "DROP TABLE IF EXISTS {$table_name} cascade"); -pg_query($db, "DROP TABLE if exists {$table_name_92} cascade"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name_92} cascade"); ?> --EXPECT-- OK From d94c10a79983be0b2ba9f09cbc890fc380d853ab Mon Sep 17 00:00:00 2001 From: KentarouTakeda Date: Mon, 6 Nov 2023 22:19:57 +0900 Subject: [PATCH 11/17] Update ext/pgsql/tests/bug47199.phpt Co-authored-by: Gina Peter Banyard --- ext/pgsql/tests/bug47199.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pgsql/tests/bug47199.phpt b/ext/pgsql/tests/bug47199.phpt index a4a03b19c437b..50932fcbbf501 100644 --- a/ext/pgsql/tests/bug47199.phpt +++ b/ext/pgsql/tests/bug47199.phpt @@ -41,7 +41,7 @@ require_once('inc/config.inc'); $dbh = pg_connect($conn_str); $tbl_name = 'test_47199'; -pg_query($dbh, "DROP TABLE $tbl_name"); +pg_query($dbh, "DROP TABLE IF EXISTS $tbl_name"); ?> --EXPECT-- array(2) { From 2827132a5913787c4e9957e3e78bbb9cfdffa198 Mon Sep 17 00:00:00 2001 From: KentarouTakeda Date: Mon, 6 Nov 2023 22:20:10 +0900 Subject: [PATCH 12/17] Update ext/pgsql/tests/bug72028.phpt Co-authored-by: Gina Peter Banyard --- ext/pgsql/tests/bug72028.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pgsql/tests/bug72028.phpt b/ext/pgsql/tests/bug72028.phpt index 6bfad86fa2eab..5c0c0f443f3d3 100644 --- a/ext/pgsql/tests/bug72028.phpt +++ b/ext/pgsql/tests/bug72028.phpt @@ -40,7 +40,7 @@ require_once('inc/config.inc'); $table = "bug72028";; $conn = pg_connect($conn_str); -pg_query($conn, "DROP TABLE $table"); +pg_query($conn, "DROP TABLE IF EXISTS $table"); ?> --EXPECT-- array(2) { From 33ae90d8dae9d9a80f1bebfd2f4d5636886743e3 Mon Sep 17 00:00:00 2001 From: KentarouTakeda Date: Mon, 6 Nov 2023 22:20:24 +0900 Subject: [PATCH 13/17] Update ext/pgsql/tests/bug71062.phpt Co-authored-by: Gina Peter Banyard --- ext/pgsql/tests/bug71062.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pgsql/tests/bug71062.phpt b/ext/pgsql/tests/bug71062.phpt index 30caf75132818..d05f8c88a237f 100644 --- a/ext/pgsql/tests/bug71062.phpt +++ b/ext/pgsql/tests/bug71062.phpt @@ -38,7 +38,7 @@ require_once('inc/config.inc'); $db = @pg_connect($conn_str); $table = "public.test_table_bug71062_bug71062"; -pg_query($db, "DROP TABLE $table"); +pg_query($db, "DROP TABLE IF EXISTS $table"); ?> --EXPECT-- trying format Y-m-d\TH:i:sO From 8c999252675cbc2d984355274387f133b9a10d22 Mon Sep 17 00:00:00 2001 From: KentarouTakeda Date: Mon, 6 Nov 2023 22:23:06 +0900 Subject: [PATCH 14/17] Update ext/pgsql/tests/bug68638.phpt Co-authored-by: Gina Peter Banyard --- ext/pgsql/tests/bug68638.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pgsql/tests/bug68638.phpt b/ext/pgsql/tests/bug68638.phpt index 0636b1d5abd75..957e9a33abf5d 100644 --- a/ext/pgsql/tests/bug68638.phpt +++ b/ext/pgsql/tests/bug68638.phpt @@ -38,7 +38,7 @@ require_once('inc/config.inc'); $conn = pg_connect($conn_str); $table='test_68638'; -pg_query($conn, "DROP TABLE $table"); +pg_query($conn, "DROP TABLE IF EXISTS $table"); ?> --EXPECT-- string(52) "UPDATE "test_68638" SET "value"=E'inf' WHERE "id"=1;" From c6ec16c7193cc1be42fa5cc7cf96f342527fdb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Mon, 6 Nov 2023 22:33:36 +0900 Subject: [PATCH 15/17] refactor(ext/pgsql/tests): drop explicitly without using `cascade` --- ext/pgsql/tests/pg_select_001.phpt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/pgsql/tests/pg_select_001.phpt b/ext/pgsql/tests/pg_select_001.phpt index bc7ca63cc0813..d6ac2dfe07f6a 100644 --- a/ext/pgsql/tests/pg_select_001.phpt +++ b/ext/pgsql/tests/pg_select_001.phpt @@ -51,7 +51,9 @@ $schema_name = 'schema_pg_select_001'; $conn = pg_connect($conn_str); -pg_query($conn, "DROP SCHEMA IF EXISTS {$schema_name} CASCADE"); +pg_query($conn, "DROP TABLE IF EXISTS {$schema_name}.foo"); +pg_query($conn, "DROP TABLE IF EXISTS {$schema_name}.bar"); +pg_query($conn, "DROP SCHEMA IF EXISTS {$schema_name}"); ?> --EXPECTF-- Warning: pg_select(): Table 'foo' doesn't exists in %s on line %d From 89aa3f76c30f2444d2f856511d7ddda584fbdba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Mon, 6 Nov 2023 22:34:37 +0900 Subject: [PATCH 16/17] fix(ext/pgsql/tests): unify writing style --- ext/pgsql/tests/9999dropdb.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt index 9537dd7f19645..251e0dd7ac980 100644 --- a/ext/pgsql/tests/9999dropdb.phpt +++ b/ext/pgsql/tests/9999dropdb.phpt @@ -19,8 +19,8 @@ pg_query($db, "CREATE TABLE {$table_name_92} (textary text[], jsn json)"); pg_query($db, "CREATE VIEW {$view_name} as SELECT * FROM {$table_name}"); pg_query($db, "DROP VIEW IF EXISTS {$view_name}"); -pg_query($db, "DROP TABLE ".$table_name); -@pg_query($db, "DROP TABLE ".$table_name_92); +pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); +pg_query($db, "DROP TABLE IF EXISTS {$table_name_92}"); echo "OK"; From eadb74cb36cae1a0326cc984f176de95630033c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Tue, 7 Nov 2023 07:28:02 +0900 Subject: [PATCH 17/17] fix(ext/pgsql/tests): `dropdb` test also `DROP` even with `--CLEAN--`. --- ext/pgsql/tests/9999dropdb.phpt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt index 251e0dd7ac980..b8c7d84beb0dd 100644 --- a/ext/pgsql/tests/9999dropdb.phpt +++ b/ext/pgsql/tests/9999dropdb.phpt @@ -18,11 +18,25 @@ pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)"); pg_query($db, "CREATE TABLE {$table_name_92} (textary text[], jsn json)"); pg_query($db, "CREATE VIEW {$view_name} as SELECT * FROM {$table_name}"); +pg_query($db, "DROP VIEW {$view_name}"); +pg_query($db, "DROP TABLE {$table_name}"); +pg_query($db, "DROP TABLE {$table_name_92}"); + +echo "OK"; + +?> +--CLEAN-- + --EXPECT--