Fix param-conversion and error-rollback regression test in PG12.
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Sun, 5 Jan 2020 02:05:57 +0000 (11:05 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Sun, 5 Jan 2020 02:05:57 +0000 (11:05 +0900)
Old param-conversions.out was renamed param-conversions_2.out.
Old param-conversions_1.out was renamed param-conversions_3.out.
Old error-rollback.out was renamed error-rollback_1.out.

test/expected/error-rollback.out
test/expected/error-rollback_1.out [new file with mode: 0644]
test/expected/param-conversions.out
test/expected/param-conversions_1.out
test/expected/param-conversions_2.out [new file with mode: 0644]
test/expected/param-conversions_3.out [new file with mode: 0644]

index 99eb3594fa185527318fb37b271e2388ec433a1f..24cc4a90540f53050129c1162b416f37e6442e77 100644 (file)
@@ -3,7 +3,7 @@ connected
 Executing query that will succeed
 Executing query that will fail
 Failed to execute statement
-22P02=ERROR: invalid input syntax for integer: "fail1";
+22P02=ERROR: invalid input syntax for type integer: "fail1";
 Error while executing the query
 Rolling back with SQLEndTran
 Executing query that will succeed
@@ -15,7 +15,7 @@ connected
 Executing query that will succeed
 Executing query that will fail
 Failed to execute statement
-22P02=ERROR: invalid input syntax for integer: "fail1";
+22P02=ERROR: invalid input syntax for type integer: "fail1";
 Error while executing the query
 Executing query that will succeed
 Result set:
@@ -27,17 +27,17 @@ Executing query that will succeed
 Executing query that will succeed
 Executing query that will fail
 Failed to execute statement
-22P02=ERROR: invalid input syntax for integer: "fail-1";
+22P02=ERROR: invalid input syntax for type integer: "fail-1";
 Error while executing the query
 Executing query that will succeed
 Executing query that will succeed
 Executing query that will fail
 Failed to execute statement
-22P02=ERROR: invalid input syntax for integer: "fail-1";
+22P02=ERROR: invalid input syntax for type integer: "fail-1";
 Error while executing the query
 Executing query that will fail
 Failed to execute statement
-22P02=ERROR: invalid input syntax for integer: "fail-1";
+22P02=ERROR: invalid input syntax for type integer: "fail-1";
 Error while executing the query
 Executing query that will succeed
 Executing procedure call that will fail
diff --git a/test/expected/error-rollback_1.out b/test/expected/error-rollback_1.out
new file mode 100644 (file)
index 0000000..99eb359
--- /dev/null
@@ -0,0 +1,57 @@
+Test for rollback protocol 0
+connected
+Executing query that will succeed
+Executing query that will fail
+Failed to execute statement
+22P02=ERROR: invalid input syntax for integer: "fail1";
+Error while executing the query
+Rolling back with SQLEndTran
+Executing query that will succeed
+Result set:
+1
+disconnecting
+Test for rollback protocol 1
+connected
+Executing query that will succeed
+Executing query that will fail
+Failed to execute statement
+22P02=ERROR: invalid input syntax for integer: "fail1";
+Error while executing the query
+Executing query that will succeed
+Result set:
+1
+disconnecting
+Test for rollback protocol 2
+connected
+Executing query that will succeed
+Executing query that will succeed
+Executing query that will fail
+Failed to execute statement
+22P02=ERROR: invalid input syntax for integer: "fail-1";
+Error while executing the query
+Executing query that will succeed
+Executing query that will succeed
+Executing query that will fail
+Failed to execute statement
+22P02=ERROR: invalid input syntax for integer: "fail-1";
+Error while executing the query
+Executing query that will fail
+Failed to execute statement
+22P02=ERROR: invalid input syntax for integer: "fail-1";
+Error while executing the query
+Executing query that will succeed
+Executing procedure call that will fail
+Failed to execute procedure call
+42883=ERROR: function invalidfunction() does not exist;
+Error while executing the query
+Executing query that will succeed
+Executing query that will succeed
+Result set:
+1
+2
+3
+4
+5
+6
+7
+disconnecting
index 777cc946cff9bc5ee6098a004a24c07bc0eeabf1..c67c47bebe2128490c01f8b1a332712874765054 100644 (file)
@@ -27,7 +27,7 @@ Result set:
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_CHAR param "5 escapes: \ and '"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "5 escapes: \ and '";
+22P02=ERROR: invalid input syntax for type integer: "5 escapes: \ and '";
 Error while executing the query
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "32767"...
@@ -62,12 +62,12 @@ Error while executing the query
 Testing conversions with invalid values...
 Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_INTEGER param "2, 'injected, BAD!'"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "2, 'injected, BAD!'";
+22P02=ERROR: invalid input syntax for type integer: "2, 'injected, BAD!'";
 Error while executing the query
 
 Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "2, 'injected, BAD!'"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "2, 'injected, BAD!'";
+22P02=ERROR: invalid input syntax for type smallint: "2, 'injected, BAD!'";
 Error while executing the query
 
 Testing "SELECT 1.3 > ?" with SQL_C_CHAR -> SQL_FLOAT param "3', 'injected, BAD!', '1"...
@@ -86,12 +86,12 @@ Result set:
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "-"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "-";
+22P02=ERROR: invalid input syntax for type integer: "-";
 Error while executing the query
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param ""...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "";
+22P02=ERROR: invalid input syntax for type integer: "";
 Error while executing the query
 
 Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_SMALLINT param "-1"...
@@ -100,12 +100,12 @@ Result set:
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "-";
+22P02=ERROR: invalid input syntax for type smallint: "-";
 Error while executing the query
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param ""...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "";
+22P02=ERROR: invalid input syntax for type smallint: "";
 Error while executing the query
 
 Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_INTEGER param 1234...
index 8c8e0031cbaf6a55b48a56cba29a4ba978bedbf3..5a39477698f7aa796a36dcbd348208b0cbf33bad 100644 (file)
@@ -27,7 +27,7 @@ Result set:
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_CHAR param "5 escapes: \ and '"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "5 escapes: \ and '";
+22P02=ERROR: invalid input syntax for type integer: "5 escapes: \ and '";
 Error while executing the query
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "32767"...
@@ -61,12 +61,12 @@ Result set:
 Testing conversions with invalid values...
 Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_INTEGER param "2, 'injected, BAD!'"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "2, 'injected, BAD!'";
+22P02=ERROR: invalid input syntax for type integer: "2, 'injected, BAD!'";
 Error while executing the query
 
 Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "2, 'injected, BAD!'"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "2, 'injected, BAD!'";
+22P02=ERROR: invalid input syntax for type smallint: "2, 'injected, BAD!'";
 Error while executing the query
 
 Testing "SELECT 1.3 > ?" with SQL_C_CHAR -> SQL_FLOAT param "3', 'injected, BAD!', '1"...
@@ -85,12 +85,12 @@ Result set:
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "-"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "-";
+22P02=ERROR: invalid input syntax for type integer: "-";
 Error while executing the query
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param ""...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "";
+22P02=ERROR: invalid input syntax for type integer: "";
 Error while executing the query
 
 Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_SMALLINT param "-1"...
@@ -99,12 +99,12 @@ Result set:
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-"...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "-";
+22P02=ERROR: invalid input syntax for type smallint: "-";
 Error while executing the query
 
 Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param ""...
 SQLExecDirect failed
-22P02=ERROR: invalid input syntax for integer: "";
+22P02=ERROR: invalid input syntax for type smallint: "";
 Error while executing the query
 
 Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_INTEGER param 1234...
diff --git a/test/expected/param-conversions_2.out b/test/expected/param-conversions_2.out
new file mode 100644 (file)
index 0000000..777cc94
--- /dev/null
@@ -0,0 +1,160 @@
+connected
+
+Testing conversions...
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "2"...
+Result set:
+0
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "-2"...
+Result set:
+1
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "2"...
+Result set:
+0
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-2"...
+Result set:
+1
+
+Testing "SELECT 2.2 > ?" with SQL_C_CHAR -> SQL_FLOAT param "2.3"...
+Result set:
+0
+
+Testing "SELECT 3.3 > ?" with SQL_C_CHAR -> SQL_DOUBLE param "3.01"...
+Result set:
+1
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_CHAR param "5 escapes: \ and '"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "5 escapes: \ and '";
+Error while executing the query
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "32767"...
+Result set:
+0
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-32768"...
+Result set:
+1
+
+
+Testing conversions whose result depend on whether the
+parameter is treated as a string or an integer...
+Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_INTEGER param "6"...
+Result set:
+1
+
+Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_SMALLINT param "6"...
+Result set:
+1
+
+Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_CHAR param "6"...
+Result set:
+0
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "99999999999999999999999"...
+SQLExecDirect failed
+22003=ERROR: value "99999999999999999999999" is out of range for type integer;
+Error while executing the query
+
+
+Testing conversions with invalid values...
+Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_INTEGER param "2, 'injected, BAD!'"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "2, 'injected, BAD!'";
+Error while executing the query
+
+Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "2, 'injected, BAD!'"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "2, 'injected, BAD!'";
+Error while executing the query
+
+Testing "SELECT 1.3 > ?" with SQL_C_CHAR -> SQL_FLOAT param "3', 'injected, BAD!', '1"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for type numeric: "3', 'injected, BAD!', '1";
+Error while executing the query
+
+Testing "SELECT 1.4 > ?" with SQL_C_CHAR -> SQL_FLOAT param "4 \'bad', '1"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for type numeric: "4 \'bad', '1";
+Error while executing the query
+
+Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_INTEGER param "-1"...
+Result set:
+2
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "-"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "-";
+Error while executing the query
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param ""...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "";
+Error while executing the query
+
+Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_SMALLINT param "-1"...
+Result set:
+2
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "-";
+Error while executing the query
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param ""...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "";
+Error while executing the query
+
+Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_INTEGER param 1234...
+Result set:
+-1234
+
+Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_INTEGER param -1234...
+Result set:
+1234
+
+Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_SMALLINT param 1234...
+Result set:
+-1234
+
+Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_SMALLINT param -1234...
+Result set:
+1234
+
+
+Testing bytea conversions
+Testing "SELECT ?" with SQL_C_BINARY -> SQL_BINARY param...
+Result set:
+666f6f0a5c62617200
+
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_BINARY param "666f6f0001"...
+Result set:
+666f6f0001
+
+Testing "SELECT ?::text" with SQL_C_BINARY -> SQL_CHAR param...
+Result set:
+foo
+\bar
+
+
+Testing datetime conversions
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIMESTAMP param "04-22-2011 01:23:45"...
+Result set:
+2011-04-22 01:23:45
+
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIMESTAMP param "{ts '2011-04-22 01:23:45'}"...
+Result set:
+2011-04-22 01:23:45
+
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIME param "{t '01:23:45'}"...
+Result set:
+01:23:45
+
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_DATE param "{d '2011-04-22'}"...
+Result set:
+2011-04-22
+
+disconnecting
diff --git a/test/expected/param-conversions_3.out b/test/expected/param-conversions_3.out
new file mode 100644 (file)
index 0000000..8c8e003
--- /dev/null
@@ -0,0 +1,159 @@
+connected
+
+Testing conversions...
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "2"...
+Result set:
+0
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "-2"...
+Result set:
+1
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "2"...
+Result set:
+0
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-2"...
+Result set:
+1
+
+Testing "SELECT 2.2 > ?" with SQL_C_CHAR -> SQL_FLOAT param "2.3"...
+Result set:
+0
+
+Testing "SELECT 3.3 > ?" with SQL_C_CHAR -> SQL_DOUBLE param "3.01"...
+Result set:
+1
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_CHAR param "5 escapes: \ and '"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "5 escapes: \ and '";
+Error while executing the query
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "32767"...
+Result set:
+0
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-32768"...
+Result set:
+1
+
+
+Testing conversions whose result depend on whether the
+parameter is treated as a string or an integer...
+Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_INTEGER param "6"...
+Result set:
+1
+
+Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_SMALLINT param "6"...
+Result set:
+1
+
+Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_CHAR param "6"...
+Result set:
+0
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "99999999999999999999999"...
+Result set:
+0
+
+
+Testing conversions with invalid values...
+Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_INTEGER param "2, 'injected, BAD!'"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "2, 'injected, BAD!'";
+Error while executing the query
+
+Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "2, 'injected, BAD!'"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "2, 'injected, BAD!'";
+Error while executing the query
+
+Testing "SELECT 1.3 > ?" with SQL_C_CHAR -> SQL_FLOAT param "3', 'injected, BAD!', '1"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for type double precision: "3', 'injected, BAD!', '1";
+Error while executing the query
+
+Testing "SELECT 1.4 > ?" with SQL_C_CHAR -> SQL_FLOAT param "4 \'bad', '1"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for type double precision: "4 \'bad', '1";
+Error while executing the query
+
+Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_INTEGER param "-1"...
+Result set:
+2
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "-"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "-";
+Error while executing the query
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param ""...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "";
+Error while executing the query
+
+Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_SMALLINT param "-1"...
+Result set:
+2
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-"...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "-";
+Error while executing the query
+
+Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param ""...
+SQLExecDirect failed
+22P02=ERROR: invalid input syntax for integer: "";
+Error while executing the query
+
+Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_INTEGER param 1234...
+Result set:
+-1234
+
+Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_INTEGER param -1234...
+Result set:
+1234
+
+Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_SMALLINT param 1234...
+Result set:
+-1234
+
+Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_SMALLINT param -1234...
+Result set:
+1234
+
+
+Testing bytea conversions
+Testing "SELECT ?" with SQL_C_BINARY -> SQL_BINARY param...
+Result set:
+\x666F6F0A5C62617200
+
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_BINARY param "666f6f0001"...
+Result set:
+\x666F6F0001
+
+Testing "SELECT ?::text" with SQL_C_BINARY -> SQL_CHAR param...
+Result set:
+foo
+\bar
+
+
+Testing datetime conversions
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIMESTAMP param "04-22-2011 01:23:45"...
+Result set:
+2011-04-22 01:23:45
+
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIMESTAMP param "{ts '2011-04-22 01:23:45'}"...
+Result set:
+2011-04-22 01:23:45
+
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIME param "{t '01:23:45'}"...
+Result set:
+01:23:45
+
+Testing "SELECT ?" with SQL_C_CHAR -> SQL_DATE param "{d '2011-04-22'}"...
+Result set:
+2011-04-22
+
+disconnecting