Open lmwnshn opened 4 years ago
In normal postgres psql
, you can check the error code of your executed SQL:
postgres=# select 1;
?column?
----------
1
(1 row)
postgres=# \errverbose
There is no previous error.
postgres=# set foo to bar;
ERROR: unrecognized configuration parameter "foo"
postgres=# \errverbose
ERROR: 42704: unrecognized configuration parameter "foo"
LOCATION: set_config_option, guc.c:6749
We would like to be able to specify an optional parameter to statement error, statement error ERROR_CODE
.
Such as statement error 42704
.
Which will check that the statement returns the error code 42704.
You can do this in Java by checking getSqlState().
@mbutrovich and I were discussing how to test #1073. For now, we are punting / only running local tests. The issue is that we don't have a mechanism for specifying "this query should return this error code".
statement error
also doesn't seem to pick up on the presence of error codes, e.g. it should fail the followingbut returns
java.lang.Exception: Failure at Line 56: Expected failure but success
.