diff options
| author | Honza Král <Honza.Kral@gmail.com> | 2013-02-23 15:05:24 -0800 |
|---|---|---|
| committer | Honza Král <Honza.Kral@gmail.com> | 2013-02-23 15:05:24 -0800 |
| commit | fc38d6a92be8baec1d02fbdf95e56c4204b9425b (patch) | |
| tree | 15de6144c4d7c03e9a69f819f06382ba998885f2 /django | |
| parent | 692902b227b4aff8a4ec66fa8d4ac2d3128bcac0 (diff) | |
| parent | 2b76f19f2b89ac96bae2a169d71b23553c8101c7 (diff) | |
Merge pull request #813 from HiddenData/ticket-19263
fixes #19263 - EmptyResultSet in subquery causes incorrect SQL
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/sql/where.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index ef856893b5..603ae3dfbe 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -204,6 +204,10 @@ class WhereNode(tree.Node): raise EmptyResultSet if extra: return ('%s IN %s' % (field_sql, extra), params) + if not params: + # Empty params would generate invalid sql in subquery + raise EmptyResultSet + max_in_list_size = connection.ops.max_in_list_size() if max_in_list_size and len(params) > max_in_list_size: # Break up the params list into an OR of manageable chunks. |
