summaryrefslogtreecommitdiff
path: root/django/db/models/fields/tuple_lookups.py
AgeCommit message (Collapse)Author
2025-08-07Fixed #36210, Refs #36181 -- Allowed Subquery usage in further lookups ↵Jacob Walls
against composite pks. Follow-up to 8561100425876bde3be4b2a22324655f74ff9609. Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-07-28Fixed #36522 -- Added support for filtering composite pks using a tuple of ↵Simon Charette
expressions. Thanks Jacob Walls for the report, and Sarah Boyce and Mariusz Felisiak for reviews.
2025-07-23Refs #36500 -- Corrected rewrapped long lines fixed via a script.Mike Edmunds
Manually reformatted some comments and docstrings where autofix_w505.py changed the meaning of the formatting.
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-06-30Fixed #36464 -- Fixed "__in" tuple lookup on backends lacking native support.Simon Charette
When native support for tuple lookups is missing in a DB backend, it can be emulated with an EXISTS clause. This is controlled by the backend feature flag "supports_tuple_lookups". The mishandling of subquery right-hand side in `TupleIn` (added to support `CompositePrimaryKey` in Refs #373) was likely missed because the only core backend we test with the feature flag disabled (Oracle < 23.4) supports it natively. Thanks to Nandana Raol for the report, and to Sarah Boyce, Jacob Walls, and Natalia Bidart for reviews.
2025-04-03Fixed #36290 -- Made TupleIn() lookup discard tuples containing None.Simon Charette
Just like the In() lookup discards of None members TupleIn() should discard tuples containing any None as NULL != NULL in SQL and the framework expects such queries to be elided under some circumstances. Refs #31667, #36116. Thanks Basptise Mispelon for bisecting the regression to 626d77e.
2025-02-13Fixed #36181 -- Allowed Subquery usage in __in lookups against composite pks.Simon Charette
Thanks Jacob Walls for the report.
2025-02-11Fixed #36149 -- Allowed subquery values against tuple exact and in lookups.Simon Charette
Non-tuple exact and in lookups have specialized logic for subqueries that can be adapted to properly assign select mask if unspecified and ensure the number of involved members are matching on both side of the operator.
2025-02-09Fixed #36148 -- Enabled native tuple comparison lookups on SQLite 3.37+ and ↵Simon Charette
Oracle 23.4+. VALUES must be explicitly specified when declaring a sequence of tuples on SQLite < 3.37 but it's not required on >= 3.37. See sqlite/sqlite@9289f51 which addressed the last remaining issue with IN.
2025-02-09Refs #36148 -- Relied on a feature switch to define tuple lookups support.Simon Charette
This should allow backends more easily opt-in or out of native support and rely on the fallback if unavailable.
2025-02-09Refs #373 -- Delegated Tuple compilation to compiler.Simon Charette
This should allow third-party backends to define Tuple.as_vendor() overrides that are taken into consideration which calling as_sql() directly prevents.
2025-01-13Refs #36050 -- Fixed OuterRef support for CompositePrimaryKey on Oracle.Simon Charette
Oracle doesn't support native tuple comparison so each as_oracle implementation of tuple lookups must also perform right-hand-side sanitization.
2025-01-10Fixed #36050 -- Added OuterRef support to CompositePrimaryKey.Bendeguz Csirmaz
2025-01-07Refs #36042 -- Raised ValueError when providing composite expressions to ↵Jacob Walls
aggregates.
2024-11-29Fixed #373 -- Added CompositePrimaryKey.Bendeguz Csirmaz
Thanks Lily Foote and Simon Charette for reviews and mentoring this Google Summer of Code 2024 project. Co-authored-by: Simon Charette <charette.s@gmail.com> Co-authored-by: Lily Foote <code@lilyf.org>
2024-11-04Refs #373 -- Added TupleIn subqueries.Bendeguz Csirmaz
2024-10-14Refs #373 -- Added additional validations to tuple lookups.Bendeguz Csirmaz
2024-09-26Refs #373 -- Added support for using tuple lookups in filters.Bendeguz Csirmaz
2024-09-20Refs #373 -- Updated TupleIsNull lookup to check if any is NULL rather than all.Bendeguz Csirmaz
Regression in 1eac690d25dd49088256954d4046813daa37dc95.
2024-09-11Refs #373 -- Refactored variable assignments in ColPairs and tuple lookups.Bendeguz Csirmaz
2024-09-11Refs #373 -- Improved test coverage of tuple lookup checks.Bendeguz Csirmaz
This also removed unreachable checks.
2024-08-01Refs #373 -- Added tuple lookups.Bendeguz Csirmaz