Uploaded image for project: 'Tuigwaa'
  1. Tuigwaa
  2. TUIGWAA-157

PostgreSQL 試用時に、where 句を発行するようなフィルタと、集計表を併せて利用するとSQLGrammarExceptionが発生する。

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1-beta1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      PostgreSQL

      Description

      データベースにPostgreSQLを試用している場合、where 句を発行するようなフィルタと、集計表を併せて使うと、

      select creationus1_.username as y0_,
      this_.date as y1_,
      sum(this_.a) as y2_
      from test.fuga_
      this_ inner join test.tgw_user_ creationus1_ on this_.creationUser=creationus1_.id
      where y1_ between ? and ? and creationus1_.username=?
      group by creationus1_.username, this_.date

      のようなSQL文が発行され、以下のようなエラーが発生する。

      Caused by: org.seasar.framework.exception.SSQLException: [ESSR0072]SQLで例外(SQL=[select creationus1_.username as y0_, this_.date as y1_, sum(this_.ac) as y2_ from project.track_ this_ inner join project.tgw_user_ creationus1_ on this_.creationUser=creationus1_.id where y1_ between ? and ? and creationus1_.username=? group by creationus1_.username, this_.date], ErrorCode=0, SQLState=42703)が発生しました
      at org.seasar.extension.dbcp.impl.ConnectionWrapperImpl$PreparedStatementWrapper.wrapException(ConnectionWrapperImpl.java:555)
      at org.seasar.extension.dbcp.impl.ConnectionWrapperImpl$PreparedStatementWrapper.wrapException(ConnectionWrapperImpl.java:550)
      at org.seasar.extension.dbcp.impl.ConnectionWrapperImpl$PreparedStatementWrapper.executeQuery(ConnectionWrapperImpl.java:566)
      at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
      at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
      at org.hibernate.loader.Loader.doQuery(Loader.java:662)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      at org.hibernate.loader.Loader.doList(Loader.java:2145)
      ... 70 more
      Caused by: org.postgresql.util.PSQLException: ERROR: column "y1_" does not exist
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:250)
      at org.seasar.extension.dbcp.impl.ConnectionWrapperImpl$PreparedStatementWrapper.executeQuery(ConnectionWrapperImpl.java:564)
      ... 75 more
      org.hibernate.exception.SQLGrammarException: could not execute query
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.loader.Loader.doList(Loader.java:2148)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
      at org.hibernate.loader.Loader.list(Loader.java:2024)
      at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
      at org.seasar.tuigwaa.database.function.criteria.HibernateCriteria.list(HibernateCriteria.java:239)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              takishita takishita
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: