OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.45k stars 2.4k forks source link

SQL Query fails with "ORDER BY random()" #16961

Closed SzymonSel closed 2 weeks ago

SzymonSel commented 2 weeks ago

Describe the bug

SQL Query with random ordering fails with: Syntax error, expected: ASC, DESC, ., ,, ), LIMIT, OFFSET, UNION, ;, WITH, SELECT at line:5, col:15

Orchard Core version

Latest 2.0

To Reproduce

  1. Go to Admin Panel -> Search -> SQL Queries
  2. Create/Run query:
    SELECT DocumentId 
    FROM ContentItemIndex 
    WHERE 
    ContentType='BlogPost' and Published = true
    ORDER BY random()
    LIMIT 10

Expected behavior

Should return random 10 BlogPost content items.

Logs and screenshots

image

hishamco commented 2 weeks ago

SqlParser need to be reviewed

github-actions[bot] commented 2 weeks ago

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.