]> granicus.if.org Git - php/commitdiff
Add a test for bug 73498
authorCraig Duncan <git@duncanc.co.uk>
Mon, 21 Nov 2016 19:49:18 +0000 (19:49 +0000)
committerAnatol Belski <ab@php.net>
Mon, 21 Nov 2016 23:42:45 +0000 (00:42 +0100)
ext/pgsql/tests/01createdb.phpt
ext/pgsql/tests/06_bug73498.phpt [new file with mode: 0644]
ext/pgsql/tests/9999dropdb.phpt
ext/pgsql/tests/config.inc

index 8f7a26284117e43ff37be4c6aa315f5899471280..aa2e43748fae9b73c42ffb721400c27c73f99cef 100644 (file)
@@ -29,6 +29,9 @@ else {
        echo pg_last_error()."\n";
 }
 
+// Create view here
+pg_query($db,$view_def);
+
 pg_close($db);
 
 echo "OK";
diff --git a/ext/pgsql/tests/06_bug73498.phpt b/ext/pgsql/tests/06_bug73498.phpt
new file mode 100644 (file)
index 0000000..fdb2af2
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Bug 73498 Incorrect DELIMITER syntax for pg_copy_to()
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+
+$rows = pg_copy_to($db, "(select * from {$view_name})");
+
+var_dump(gettype($rows));
+var_dump(count($rows) > 0);
+
+?>
+--EXPECT--
+string(5) "array"
+bool(true)
index 8cb178b2bf593f756f772edcb30b03dd8af09365..80502e54b6209332c2fbce3714b474135f985e09 100644 (file)
@@ -9,6 +9,7 @@ PostgreSQL drop db
 include('config.inc');
 
 $db = pg_connect($conn_str);
+pg_query($db, "DROP VIEW {$view_name}");
 pg_query($db, "DROP TABLE ".$table_name);
 @pg_query($db, "DROP TABLE ".$table_name_92);
 
index e9944de793cf34243f45fb30bb42fc13e35ea098..98f099c138ddd1862d7b9ef641a0bba611422dae 100644 (file)
@@ -11,6 +11,10 @@ $table_name      = "php_pgsql_test";          // test table that will be created
 $table_name_92   = "php_pgsql_test_92";       // test table that will be created
 $num_test_record = 1000;                      // Number of records to create
 
+// Test view
+$view_name   = "php_pgsql_viewtest";
+$view_def    = "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name};";
+
 // Test table
 $table_def    = "CREATE TABLE ${table_name} (num int, str text, bin bytea);";
 $table_def_92 = "CREATE TABLE ${table_name_92} (textary text[],  jsn json);";