Hi, we used to have a scheduled job that were executing the ANALYZE TABLE & OPTIMIZE TABLE for several tables.
Queries were coded using spring-data `@Query` annotation, which under the hood was invoking maria-db-client.
@Modifying
|
@Query(value = "ANALYZE TABLE xyz", nativeQuery = true)
|
void analyze();
|
In maria-db-client 2.7.x it worked correctly, however after upgrading to 3.0.5 the query stopped working. Stacktrace pointed us to ServerPreparedStatement#executeLargeUpdate.
Caused by: java.sql.SQLException: (conn=261028) the given SQL statement produces an unexpected ResultSet object
|
at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:297)
|
at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:345)
|
at org.mariadb.jdbc.ServerPreparedStatement.executeLargeUpdate(ServerPreparedStatement.java:470)
|
at org.mariadb.jdbc.ServerPreparedStatement.executeUpdate(ServerPreparedStatement.java:442)
|
So the query itself is correct, however what does not look correct is handling of result in ServerPreparedStatement, because in case of ANALYZE TABLE/OPTIMIZE TABLE the result is CompleteResult type (query succeeded tho), so it goes to the if condition that throws an exception.