Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
2.3.0
-
None
Description
SQL query with empty value as column without alias in select statement causes exception, e.g.:
getSession().createSQLQuery("SELECT '' FROM t").list();
Caused by: java.sql.SQLSyntaxErrorException: No such column:
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:236)
at org.mariadb.jdbc.internal.com.read.dao.ColumnNameMap.getIndex(ColumnNameMap.java:133)
at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.findColumn(SelectResultSet.java:1484)
at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getString(SelectResultSet.java:1017)
at sun.reflect.GeneratedMethodAccessor265.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
As workaround, with alias works fine:
getSession().createSQLQuery("SELECT '' AS a FROM t").list();