sqlvalidator icon indicating copy to clipboard operation
sqlvalidator copied to clipboard

is_valid() gives false negative with PostgreSQL limit clause

Open castagninojose opened this issue 3 years ago • 0 comments

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.

castagninojose avatar Jan 10 '23 20:01 castagninojose