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

LOWER function in ORDER BY and GROUP BY clause do not work with XWQL

    Details

    • Tests:
      Unit
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      Hi.

      Here a code to reproduce this issue:

      With HQL, use LOWER() in the ORDER BY clause do the work:

      {{velocity}}
      #set($hql = "SELECT prop.value FROM XWikiDocument doc, BaseObject obj, StringProperty prop WHERE doc.fullName = obj.name AND obj.className='XWiki.XWikiUsers' AND prop.id=obj.id AND prop.name='last_name' ORDER BY lower(prop.value)")
      #set($rs = $services.query.hql($hql).setLimit(10).execute())
      $rs
      {{/velocity}}
      
      With XWQL, it does not work:
      {{velocity}}
      #set($xwql = "SELECT obj.last_name FROM Document doc, doc.object(XWiki.XWikiUsers) obj ORDER BY lower(obj.last_name)")
      #set($rs = $services.query.xwql($xwql).setLimit(10).execute())
      $rs
      {{/velocity}}
      

      It returns an exception :

      Caused by: org.xwiki.query.jpql.parser.ParserException: [1,83] expecting: id
      	at org.xwiki.query.jpql.parser.Parser.parse(Parser.java:1247)
      

        Attachments

          Activity

            People

            • Assignee:
              gdelhumeau Guillaume Delhumeau
              Reporter:
              gdelhumeau Guillaume Delhumeau
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: