summaryrefslogtreecommitdiff
path: root/tests/composite_pk
AgeCommit message (Collapse)Author
2025-11-04[6.0.x] Fixed #36704 -- Fixed system check error for proxy model with a ↵Hal Blackburn
composite pk. Proxy models subclassing a model with a CompositePrimaryKey were incorrectly reporting check errors because the check that requires only local fields to be used in a composite pk was evaluated against the proxy subclass, which has no fields. To fix this, composite pk field checks are not evaluated against proxy subclasses, as none of the checks are applicable to proxy subclasses. This also has the benefit of not double-reporting real check errors from an invalid superclass pk. Thanks Clifford Gama for the review. Backport of 74564946c3b42a2ef7d087047e49873847a7e1d9 from main.
2025-10-15[6.0.x] Refs #36648 -- Removed hardcoded pk in CompositePKAggregateTests.Jacob Walls
Backport of bee64561a6e8cd22995c2b1254bab66dae892a6d from main.
2025-10-14[6.0.x] Fixed #36648, Refs #33772 -- Accounted for composite pks in ↵Jacob Walls
first()/last() when aggregating. Backport of 02eed4f37879b2077496f86bb1378a076b981233 from main.
2025-09-22[6.0.x] Fixed #35453 -- Made ManyToManyField.concrete False.Ryan P Kilby
ManyToManyField was already excluded from fields, concrete_fields, and local_concrete_fields in Options. Backport of f9a44cc0fac653f8e0c2ab1cdfb12b2cc5c63fc2 from main
2025-09-04Fixed #36481 -- Fixed QuerySet.update concrete fields check.Ryan P Kilby
FieldError is now emitted for invalid update calls involving reverse relations, where previously they failed with AttributeError.
2025-08-29Fixed #36431 -- Returned tuples for multi-column ForeignObject in ↵SaJH
values()/values_list(). Thanks Jacob Walls and Simon Charette for tests. Signed-off-by: SaJH <wogur981208@gmail.com>
2025-08-21Refs #36430, #36416, #34378 -- Simplified batch size calculation in ↵Jacob Walls
QuerySet.in_bulk().
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-08-07Refs #36210 -- Added missing limits in Subquery tests.Jacob Walls
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-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-06-03Fixed #36416 -- Made QuerySet.in_bulk() account for composite pks in id_list.Jacob Walls
2025-05-16Fixed #36392 -- Raised ValueError when subquery referencing composite pk ↵Jacob Walls
selects too many columns.
2025-05-12Fixed #36373 -- Fixed select_related() crash on foreign object for a ↵Simon Charette
composite pk. Thanks Jacob Walls for the report and Sarah for the in-depth review.
2025-04-17Fixed #36326 -- Added CompositePrimaryKey support in QuerySet.raw().SaJH
Signed-off-by: SaJH <wogur981208@gmail.com>
2025-04-11Fixed #36288 -- Addressed improper handling of duplicates in values_list().Simon Charette
Now that selected aliases are stored in sql.Query.selected: dict[str, Any] the values_list() method must ensures that duplicate field name references are assigned unique aliases. Refs #28900. Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a. Thanks Claude for the report.
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-01-28Fixed #36122 -- Raised FieldError when updating with composite reference value.Simon Charette
Thanks Jacob Walls for the report and test.
2025-01-28Fixed #36120 -- Raised FieldError when targeting a composite primary key ↵Jacob Walls
field with QuerySet.update().
2025-01-22Fixed #36117 -- Raised ValueError when providing composite expressions to ↵Simon Charette
case / when. Remove redundant Case and When.resolve_expression to delegate composite expression support to BaseExpression. Thanks Jacob Tyler Walls for the report and test.
2025-01-22Refs #36042 -- Consolidated composite expression checks in BaseExpression.Simon Charette
Remove redundant Func.resolve_expression and adjust CombinedExpression to delegate source expression resolving to super() to perform checks against allows_composite_expressions in a single location.
2025-01-15Fixed #36100 -- Checked if composite pk is set in get_next/get_previous.Jacob Walls
2025-01-14Refs #36075 -- Adjusted MTI handling of _non_pk_concrete_field_names.Simon Charette
Regression in bf7b17d16d3978b2e1cee4a0f7ce8840bd1a8dc4. Thanks Sage Abdullah for the report.
2025-01-13Fixed #36092 -- Disallowed non-local fields in composite primary keys.Bendeguz Csirmaz
2025-01-13Refs #36075 -- Used field in pk_fields over field.primary_key.Sarah Boyce
2025-01-10Fixed #36050 -- Added OuterRef support to CompositePrimaryKey.Bendeguz Csirmaz
2025-01-10Fixed #36064 -- Skipped an UPDATE when adding a model instance with a ↵Bendeguz Csirmaz
composite primary key with default values.
2025-01-10Fixed #36068 -- Raised ValueError when providing a composite PK field to ↵Jacob Walls
bulk_create() update_fields.
2025-01-09Fixed #36074 -- Excluded composite primary key fields on save() updates.Simon Charette
2025-01-08Fixed #36062 -- Handled serialization of CompositePrimaryKeys.Sarah Boyce
2025-01-08Fixed #36065 -- Fixed ordering by expression referencing composite primary key.Simon Charette
Thanks Jacob Walls for the report and test and Csirmaz Bendegúz for the review.
2025-01-08Refs #36065 -- Extracted composite primary key order by tests.Simon Charette
2025-01-07Refs #36042 -- Raised ValueError when providing composite expressions to ↵Jacob Walls
aggregates.
2025-01-07Fixed #36042 -- Raised ValueError when using CompositePrimaryKey as rhs.Jacob Walls
2025-01-06Fixed #36048 -- Preferred ValueError to NotSupportedError for composite pk ↵Jacob Walls
sanity checks. These checks are not backend-dependent.
2025-01-02Refs #373 -- Errored when providing db_column to CompositePrimaryKey.Jacob Walls
2024-12-26Refs #373 -- Fixed false failure of test_error_on_comment_pk_conflict.Tim Graham
The test failed with "NOT NULL constraint failed" rather than "UNIQUE constraint failed: tenant_id, comment_id".
2024-12-05Refs #373 -- Fixed CompositePrimaryKey tests if yaml isn't installed.Sarah Boyce
2024-12-02Refs #373 -- Simplified DatabaseIntrospection.get_constraints() tests for ↵Mariusz Felisiak
composite primary keys.
2024-12-02Refs #373 -- Fixed ↵Mariusz Felisiak
CompositePKChecksTests.test_composite_pk_cannot_include_generated_field() test crash on databases with no GeneratedField support.
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>