Skip to content

Commit d36d4c7

Browse files
duncan3dcweltling
authored andcommitted
Add a test for bug 73498
1 parent 850c109 commit d36d4c7

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

ext/pgsql/tests/01createdb.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ else {
2929
echo pg_last_error()."\n";
3030
}
3131

32+
// Create view here
33+
pg_query($db,$view_def);
34+
3235
pg_close($db);
3336

3437
echo "OK";

ext/pgsql/tests/06_bug73498.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug 73498 Incorrect DELIMITER syntax for pg_copy_to()
3+
--SKIPIF--
4+
<?php include("skipif.inc"); ?>
5+
--FILE--
6+
<?php
7+
8+
include('config.inc');
9+
10+
$db = pg_connect($conn_str);
11+
12+
$rows = pg_copy_to($db, "(select * from {$view_name})");
13+
14+
var_dump(gettype($rows));
15+
var_dump(count($rows) > 0);
16+
17+
?>
18+
--EXPECT--
19+
string(5) "array"
20+
bool(true)

ext/pgsql/tests/9999dropdb.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PostgreSQL drop db
99
include('config.inc');
1010

1111
$db = pg_connect($conn_str);
12+
pg_query($db, "DROP VIEW {$view_name}");
1213
pg_query($db, "DROP TABLE ".$table_name);
1314
@pg_query($db, "DROP TABLE ".$table_name_92);
1415

ext/pgsql/tests/config.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ $table_name = "php_pgsql_test"; // test table that will be created
1111
$table_name_92 = "php_pgsql_test_92"; // test table that will be created
1212
$num_test_record = 1000; // Number of records to create
1313

14+
// Test view
15+
$view_name = "php_pgsql_viewtest";
16+
$view_def = "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name};";
17+
1418
// Test table
1519
$table_def = "CREATE TABLE ${table_name} (num int, str text, bin bytea);";
1620
$table_def_92 = "CREATE TABLE ${table_name_92} (textary text[], jsn json);";

0 commit comments

Comments
 (0)