Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-15250

XWQL group by not working on multiselect lists

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 10.5-rc-1
    • 10.4
    • Query
    • None
    • Unit
    • Unknown
    • N/A
    • N/A
    • Pull Request accepted

    Description

      In xwql group by queries work with single select lists but not with multiselect.

      Example:

      == Query with group on single select field ==

      Works

      {{velocity}}
      $services.query.xwql("select obj.databaseList1,count(doc.fullName) from Document as doc, doc.object(Help.Applications.Movies.Code.MoviesClass) as obj group by obj.databaseList1 order by obj.databaseList1").execute()
      {{/velocity}}
      

      == Query with group on multiple select field ==

      Does not work

      {{velocity}}
      $services.query.xwql("select obj.staticList1,count(doc.fullName) from Document as doc, doc.object(Help.Applications.Movies.Code.MoviesClass) as obj group by obj.staticList1  order by obj.databaseList1").execute()
      {{/velocity}}
      

      Generates:

      Caused by: java.sql.SQLSyntaxErrorException: unexpected token: BY required: BY in statement [select list4_.XWL_VALUE as col_0_0_, count(xwikidocum0_.XWD_FULLNAME) as col_1_0_ from xwikidoc xwikidocum0_ cross join xwikiobjects baseobject1_ cross join xwikilists dbstringli2_ inner join xwikiproperties dbstringli2_1_ on dbstringli2_.XWL_ID=dbstringli2_1_.XWP_ID and dbstringli2_.XWL_NAME=dbstringli2_1_.XWP_NAME, xwikilistitems list4_ cross join xwikistrings stringprop3_ inner join xwikiproperties stringprop3_1_ on stringprop3_.XWS_ID=stringprop3_1_.XWP_ID and stringprop3_.XWS_NAME=stringprop3_1_.XWP_NAME cross join xwikilistitems list5_ where dbstringli2_.XWL_ID=list4_.XWL_ID and dbstringli2_.XWL_NAME=list4_.XWL_NAME and dbstringli2_.XWL_ID=list5_.XWL_ID and dbstringli2_.XWL_NAME=list5_.XWL_NAME and 1=1 and xwikidocum0_.XWD_FULLNAME=baseobject1_.XWO_NAME and baseobject1_.XWO_CLASSNAME='Help.Applications.Movies.Code.MoviesClass' and dbstringli2_.XWL_ID=baseobject1_.XWO_ID and dbstringli2_.XWL_NAME='staticList1' and stringprop3_.XWS_ID=baseobject1_.XWO_ID and stringprop3_.XWS_NAME='databaseList1' group by . order by stringprop3_.XWS_VALUE]
      

      Attachments

        Issue Links

          Activity

            People

              atallahade Adel Atallah
              ludovic Ludovic Dubost
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: