Skip to content

LIMIT is ignored when the LIMIT keyword is followed by a newline. #1592

@your-diary

Description

@your-diary
SELECT
    *
FROM
    foo
LIMIT 10000; -- This `LIMIT` is respected.
SELECT
    *
FROM
    foo
LIMIT
    10000; -- This `LIMIT` is ignored and overridden by `LIMIT 1000`.
           -- Also, the warning "The result was limited to 1000 rows" is shown.

Cause

The LIMIT detection is implemented a bit poorly, not utilizing the lexed tokens (source):

def _has_limit(self, sql):
    if not sql:
        return False
    return "limit " in sql.lower()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions