Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-669

SQLSyntaxErrorException: No such column: (Empty column without alias)

    XMLWordPrintable

Details

    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();

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            divus Leonid M.
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.