# HG changeset patch # User Martin van Dinther <martin.van.dinther@monetdbsolutions.com> # Date 1730998954 -3600 # Node ID f16966084980b1c067b0f33440edea81dac623dc # Parent df18aa5c8a61e3fdb8b5d8a402729c8eb61dc9d4 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. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog file for monetdb-java # This file is updated with Maddlog +* Thu Nov 7 2024 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> +- 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. + * Wed Jun 19 2024 Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> - Implemented Connection#set/getClientInfo, and send sensible default info at connect time. This can be controlled with the properties 'client_info=on/off', diff --git a/src/main/java/org/monetdb/util/MDBvalidator.java b/src/main/java/org/monetdb/util/MDBvalidator.java --- 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); } diff --git a/tests/JDBC_API_Tester.java b/tests/JDBC_API_Tester.java --- a/tests/JDBC_API_Tester.java +++ b/tests/JDBC_API_Tester.java @@ -773,7 +773,6 @@ public final class JDBC_API_Tester { "3 cert true null path to TLS certificate to authenticate server with\n"); } - private void handleExecuteDDL(Statement stmt, String action, String objtype, String objname, String sql) { try { int response = stmt.executeUpdate(sql);