Skip to content

is_valid() gives false negative with PostgreSQL limit clause #49

@castagninojose

Description

@castagninojose

I found the following case which seems to me to be a false negative. According to PG's documentation, setting LIMIT to either NULL or ALL should result in fetching all available rows (and it does).

import sqlvalidator

first_query = 'SELECT * FROM "my_table" LIMIT 10'
second_query = 'SELECT * FROM "my_table" LIMIT NULL'

Both these queries work as expected when run. However

>>> sqlvalidator.parse(first_query).is_valid()
True
>>> sqlvalidator.parse(second_query).is_valid()
False

Let me know if there's any piece of information I might have missed. If this case was considered already or it falls outside the scope of this tool feel free to close this issue.

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions