Check-in rules: Do not use empty lists in SQL converted query

This commit is contained in:
Raphael Michel
2024-01-03 09:56:35 +01:00
parent fabe476397
commit dcb1d920eb
2 changed files with 23 additions and 1 deletions

View File

@@ -74,7 +74,11 @@ class InList(Func):
raise TypeError(f'Dynamic right-hand-site currently not implemented, found {type(self.source_expressions[1])}')
rhs, rhs_params = ['%s' for _ in self.source_expressions[1].value], [d for d in self.source_expressions[1].value]
return '%s IN (%s)' % (lhs, ', '.join(rhs)), lhs_params + rhs_params
if rhs:
return '%s IN (%s)' % (lhs, ', '.join(rhs)), lhs_params + rhs_params
else:
# "IN ()" is not considered valid SQL by PostgreSQL (unlike SQLite)
return 'FALSE', []
def tolerance(b, tol=None, sign=1):