Bug #107534 | Aliases are not honored in Select statements when using Views + useCursorFetch | ||
---|---|---|---|
Submitted: | 9 Jun 2022 21:00 | Modified: | 13 Jun 2022 13:53 |
Reporter: | Mariano Gaston | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | 8.0.29 | OS: | Ubuntu (18.04.6 LTS) |
Assigned to: | CPU Architecture: | x86 | |
Tags: | alias, useCursorFetch, VIEW |
[9 Jun 2022 21:00]
Mariano Gaston
[13 Jun 2022 7:54]
MySQL Verification Team
Hello Mariano, Thank you for the report and test case. I quickly tried using your test case but not seeing any exception that you have reported. Am I missing anything here? Please let us know. Thank you. -- MySQL Server 8.0.29(hosted on EL7) import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; public class Bug107534 { public static void main(String[] args) throws ClassNotFoundException, Exception { String url = "jdbc:mysql://support-cluster03.regionaliad02.mysql2iad.oraclevcn.com:3306/test?useCursorFetch=true"; Connection conn = DriverManager.getConnection(url, "ushastry", "mysql123"); Runtime.Version version = Runtime.version(); System.out.println("JDK version: " + version); DatabaseMetaData meta = conn.getMetaData(); System.out.println("MySQL Server: " + meta.getDatabaseProductVersion()); System.out.println("Driver Name & Ver: " + meta.getDriverName() + meta.getDriverVersion()); String query = "select * from viewTest as someAlias"; PreparedStatement pstmt = conn.prepareStatement(query); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { long idMain = rs.getLong("someAlias.idMain"); long value = rs.getLong("someAlias.value"); System.out.println("idMain=" + idMain + ", value=" + value); } rs.close(); pstmt.close(); conn.close(); } } - ant -f C:\\Work\\MySQLSrc\\Bug107542 -Dnb.internal.action.name=run run init: Deleting: C:\Work\MySQLSrc\Bug107542\build\built-jar.properties deps-jar: Updating property file: C:\Work\MySQLSrc\Bug107542\build\built-jar.properties Compiling 1 source file to C:\Work\MySQLSrc\Bug107542\build\classes compile: run: JDK version: 11.0.3+12-LTS MySQL Server: 8.0.29 Driver Name & Ver: MySQL Connector/Jmysql-connector-java-8.0.29 (Revision: dd61577595edad45c398af508cf91ad26fc4144f) idMain=1, value=10 BUILD SUCCESSFUL (total time: 27 seconds) regards, Umesh
[13 Jun 2022 13:43]
Mariano Gaston
Hi Umesh, Thanks a lot for taking your time analyzing this issue. Our production servers arec currently using MySQL 5.7.38 (full version is MySQL Server: 5.7.38-0ubuntu0.18.04.1). I've just tested on MySQL 8.0.29 and it's working fine, but fails on MySQL 5.7.38. Here's a new run using your code (just to provide Java and MySQL versions): JDK version: 11.0.15 MySQL Server: 5.7.38-0ubuntu0.18.04.1 Driver Name & Ver: MySQL Connector/Jmysql-connector-java-8.0.29 (Revision: dd61577595edad45c398af508cf91ad26fc4144f) Exception in thread "main" java.sql.SQLException: Column 'someAlias.idMain' not found. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.result.ResultSetImpl.findColumn(ResultSetImpl.java:584) at com.mysql.cj.jdbc.result.ResultSetImpl.getLong(ResultSetImpl.java:862) at TestReportedMysql8.main(TestReportedMysql8.java:31) Let me know if I'm missing something. Regards, Mariano
[13 Jun 2022 13:53]
MySQL Verification Team
Hello Mariano, Thank you for the feedback. Verified as described. regards, Umesh
[17 Nov 2022 0:06]
Filipe Silva
Not a Connector/J bug. It seems to be an issue in the MySQL server which was filed in Bug#109117 (not visible until fix published).