summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-08-02 23:49:19 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2015-08-02 23:49:19 -0400
commit09cecdf285ea9f51aed669f9ea1ba840197d49d0 (patch)
tree3ae143caf62089b9579acee6b52a92ad2975a6d8 /src/test
parent690ed2b76ab91eb79ea04ee2bfbdc8a2693f2a37 (diff)
Fix a number of places that produced XX000 errors in the regression tests.
It's against project policy to use elog() for user-facing errors, or to omit an errcode() selection for errors that aren't supposed to be "can't happen" cases. Fix all the violations of this policy that result in ERRCODE_INTERNAL_ERROR log entries during the standard regression tests, as errors that can reliably be triggered from SQL surely should be considered user-facing. I also looked through all the files touched by this commit and fixed other nearby problems of the same ilk. I do not claim to have fixed all violations of the policy, just the ones in these files. In a few places I also changed existing ERRCODE choices that didn't seem particularly appropriate; mainly replacing ERRCODE_SYNTAX_ERROR by something more specific. Back-patch to 9.5, but no further; changing ERRCODE assignments in stable branches doesn't seem like a good idea.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/txid.out10
-rw-r--r--src/test/regress/regress.c6
2 files changed, 9 insertions, 7 deletions
diff --git a/src/test/regress/expected/txid.out b/src/test/regress/expected/txid.out
index 7750b7b98f9..ddd217eb102 100644
--- a/src/test/regress/expected/txid.out
+++ b/src/test/regress/expected/txid.out
@@ -20,19 +20,19 @@ select '12:16:14,14'::txid_snapshot;
-- errors
select '31:12:'::txid_snapshot;
-ERROR: invalid input for txid_snapshot: "31:12:"
+ERROR: invalid input syntax for type txid_snapshot: "31:12:"
LINE 1: select '31:12:'::txid_snapshot;
^
select '0:1:'::txid_snapshot;
-ERROR: invalid input for txid_snapshot: "0:1:"
+ERROR: invalid input syntax for type txid_snapshot: "0:1:"
LINE 1: select '0:1:'::txid_snapshot;
^
select '12:13:0'::txid_snapshot;
-ERROR: invalid input for txid_snapshot: "12:13:0"
+ERROR: invalid input syntax for type txid_snapshot: "12:13:0"
LINE 1: select '12:13:0'::txid_snapshot;
^
select '12:16:14,13'::txid_snapshot;
-ERROR: invalid input for txid_snapshot: "12:16:14,13"
+ERROR: invalid input syntax for type txid_snapshot: "12:16:14,13"
LINE 1: select '12:16:14,13'::txid_snapshot;
^
create temp table snapshot_test (
@@ -235,6 +235,6 @@ SELECT txid_snapshot '1:9223372036854775807:3';
(1 row)
SELECT txid_snapshot '1:9223372036854775808:3';
-ERROR: invalid input for txid_snapshot: "1:9223372036854775808:3"
+ERROR: invalid input syntax for type txid_snapshot: "1:9223372036854775808:3"
LINE 1: SELECT txid_snapshot '1:9223372036854775808:3';
^
diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c
index bd31a3d3825..476975f391a 100644
--- a/src/test/regress/regress.c
+++ b/src/test/regress/regress.c
@@ -549,8 +549,10 @@ ttdummy(PG_FUNCTION_ARGS)
elog(ERROR, "ttdummy (%s): %s must be NOT NULL", relname, args[1]);
if (oldon != newon || oldoff != newoff)
- elog(ERROR, "ttdummy (%s): you cannot change %s and/or %s columns (use set_ttdummy)",
- relname, args[0], args[1]);
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("ttdummy (%s): you cannot change %s and/or %s columns (use set_ttdummy)",
+ relname, args[0], args[1])));
if (newoff != TTDUMMY_INFINITY)
{