Mercurial > hg > monetdb-java
diff src/main/java/org/monetdb/util/MDBvalidator.java @ 932:f16966084980
In JdbcClient when running the \vsci or \vdbi or \vsi commands, we now suppress "42000 SELECT: insufficient privileges for ..." and "42000 SELECT: access denied for ..." error messages when the connected user does not have 'monetdb' or 'sysadmin' privileges, needed for some validations.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 07 Nov 2024 18:02:34 +0100 (5 months ago) |
parents | d311affc65f0 |
children | 80ade6a717c2 |
line wrap: on
line diff
--- a/src/main/java/org/monetdb/util/MDBvalidator.java +++ b/src/main/java/org/monetdb/util/MDBvalidator.java @@ -757,8 +757,25 @@ public final class MDBvalidator { } } } catch (SQLException e) { - System.err.println("Failed to execute query: " + qry); - printExceptions(e); + // When the connected user does not have enough select privileges, + // we may get following error messages, both with SQLState "42000": + // "SELECT: access denied for ..." or + // "SELECT: insufficient privileges for table returning function ..." + // Suppress them from the violation output report. + String state = e.getSQLState(); + boolean suppress = "42000".equals(state); + if (suppress) { + String msg = e.getMessage(); + // System.err.println("SQLState: " + state + " msg: " + msg); + if (msg != null) { + suppress = msg.startsWith("SELECT: access denied for") + || msg.startsWith("SELECT: insufficient privileges for"); + } + } + if (!suppress) { + System.err.println("Failed to execute query: " + qry); + printExceptions(e); + } } freeStmtRs(stmt, rs); }