Skip to content

Parser/Whitespace error on nested subqueries (ORDER BY/LIMIT clauses) #1025

@daniel-uribe-sperantus

Description

@daniel-uribe-sperantus

Describe the bug
I encountered a syntax error when running a valid MySQL query containing a nested subquery with WHERE conditions (inside parentheses), ORDER BY, and LIMIT.

The query executes correctly in other clients (DBeaver, MySQL CLI). I get the error message "... syntax to use near '') ORDER BY ..." suggesting that Antares might be stripping newlines or whitespace aggressively, causing the query parser to fail at the transition between the WHERE clause closing parenthesis and the ORDER BY keyword.

To Reproduce
Connect to a MySQL database.

Attempt to run a multi-line query with a subquery containing nested logic and a Limit/Order clause:

SELECT CONCAT('Prefix ', GROUP_CONCAT(sub.id SEPARATOR ' '))
FROM (
    SELECT id
    FROM my_table
    WHERE status = 1
    AND (col_a LIKE '%x%' OR col_b LIKE '%y%')
    ORDER BY created_at DESC
    LIMIT 10
) AS sub;

Expected behavior
The query to return the expected string

Application (please complete the following information):

  • MySQL
  • App version 0.7.35
  • Ubuntu SNAP

Environment (please complete the following information):

  • OS name: Ubuntu
  • OS version 24.04
  • DB name MySQL
  • DB version 8.0.40

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions