Skip to content

Union with order and limit #1116

Description

@m-larin

Query:

SELECT id FROM table1 
UNION 
SELECT id FROM table2 
ORDER BY id ASC 
LIMIT 55

normally parsed, but when calling toString, order and limit are reversed. ToString result:

SELECT id FROM table1 
UNION 
SELECT id FROM table2 
LIMIT 55
ORDER BY id ASC 

Result of toString is failed on database.

If in source query add brackets:

(SELECT id FROM table1 
UNION 
SELECT id FROM table2) 
ORDER BY id ASC 
LIMIT 55

Method toString work correct, but it is not always possible to add brackets to the original query.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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