summaryrefslogtreecommitdiff
path: root/django/db
AgeCommit message (Collapse)Author
8 daysFixed #37224 -- Skipped questioner for field changes on unmanaged models.Vishy
9 daysFixed #37239 -- Cleared stale db_default when pk comes from related object.Jacob Walls
9 daysRefs #36735 -- Added DatabaseFeatures.supports_uuid4_function_in_default ↵Jacob Walls
feature flag. Oracle 23.9 supported UUID() in SELECT contexts, but use in column defaults fails until 23.26.2.0 with: django.db.utils.DatabaseError: ORA-04044: procedure, function, package, or type is not allowed here
10 daysRefs #28586 -- Renamed RAISE fetch mode to FETCH_RAISE.Jacob Walls
This aims for consistency in the django.db.models namespace. Thanks Natalia Bidart and Simon Charette for the idea.
13 daysFixed #37238 -- Prevented fallback to python default for a pk with a db_default.Jacob Walls
Regression in a2348c85fc6c20087935c74cd99340dd4ef2dcdc.
13 daysFixed #37235 -- Added compatibility for sqlparse 0.5.5.Sarah Boyce
Thank you to Jacob Walls and Nick Pope for the review.
2026-07-29Fixed #37234 -- Fixed bulk_create() for late-saved related primary keys.Filip Sedlák
Objects with a primary key supplied by a late-saved related instance were partitioned before their related fields were prepared. This caused an assertion failure on backends returning rows from bulk inserts. Regression in 7d9aab8da0a06787d649762a702e1a518d843a63.
2026-07-24Fixed minor typos and grammatical errors in docs and docstrings.Jacob Walls
Thanks to these people for pointing these out: * Hojeong Park * Natalia Bidart * Sulav Raj Bista
2026-07-13Fixed #29303 -- Avoided mutating original view in non_atomic_requests().Sina Chaichi Maleki
Previously non_atomic_requests() mutated the _non_atomic_requests attribute of the original view function instead of returning a new wrapper.
2026-07-10Fixed #36864 -- Supported modules and submodules in import_string().Leland
Before, only submodules worked (and only if already imported). Now, all modules work regardless of prior import state. Updated expected exception in auth tests where import_string() returns a non-callable.
2026-07-10Fixed #35813 -- Made migrations track all changes to unmanaged models.Hanny
Previously, only create and delete operations were generated.
2026-06-25Refs #36593, #37187 -- Avoided spurious select_related() warning in ModelAdmin.Mike Edmunds
Changed QuerySet.select_related() "called with no arguments" deprecation warning to be issued only when called from outside Django. This prevents a confusing, cascading warning when ModelAdmin issues its own warning for list_select_related=True (see 122f0b62) and then calls QuerySet.select_related() to implement the deprecated behavior.
2026-06-18Fixed #37143 -- Added missing chunk_size=None check to QuerySet.aiterator().zhengkangyang
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2026-06-17Refs #37139 -- Renamed helper inside _is_pk_set().Jacob Walls
2026-06-15Fixed #31317 -- Avoided crash in CreateModel with unique_together and ↵David Wobrock
AlterUniqueTogether.
2026-06-11Fixed #33185 -- Fixed sqlmigrate crash for RenameModel with a ↵siddus
self-referential foreign key. When collecting SQL (e.g. for sqlmigrate), a RenameModel operation's table rename is not executed, so the subsequent field alteration introspected the renamed table before it existed. On MySQL this raised "Table doesn't exist", and on PostgreSQL the missing introspection silently omitted the self-referential foreign key's drop and recreate. The schema editor now records table renames while collecting SQL and redirects constraint-name introspection to the still-existing old table name, which carries the same constraints. Applying migrations is unaffected.
2026-06-10Fixed #37142 -- Moved django_file_prefixes() to django.utils.warnings.zhengkangyang
2026-06-05Fixed #37139 -- Fixed inlines crash on parent models with db_default on ↵Mariusz Felisiak
primary key.
2026-06-03Fixed #36492 -- Restored exact boolean lookup against literals on SQLite.Simon Charette
Performance regression in 37e6c5b on SQLite. Just like MySQL, and presumably Oracle, which don't have a native boolean type and incidently store booleans in integer columns, indices on such columns cannot be used when explicit boolean literal equalities are omitted. Adapt the logic introduced by refs #32691 for MySQL to be used for all backends that don't support native boolean fields instead of special casing MySQL, SQLite, and Oracle in their own special way. Note that review of this work surfaced that SQLite's query planner also cannot make use of indices when dealing with expressions of form WHERE NOT (indexed_bool_field = false) but that's a long standing problem unrelated to the restorative work performed in this patch. Thanks Klaas van Schelven for the report.
2026-05-20Fixed #37045 -- Renamed savepoint() to savepoint_create().Samuel Searles-Bryant
This makes the name consistent with the `savepoint_commit` and `savepoint_rollback` functions. The previous name is maintained as a deprecated alias. This also frees up the `savepoint` name, which would allow the context manager from `django-subatomic` to be included in Django. Co-authored-by: Lily <code@lilyf.org>
2026-05-18Refs #37097 -- Removed compilation-time order clearing on combined queries ↵Jacob Walls
on Oracle. Thanks Simon Charette, JaeHyuck Sa, and Shai Berger for reviews.
2026-05-18Refs #36938 -- Reverted "Refs #36938 -- Tolerated unnecessary ordering in ↵Jacob Walls
compound queries on SQLite." This mostly reverts 2314cdf1ff860058a6579bb9f9bac1253fc9ab43, but keeps the removal of some test skips.
2026-05-18Fixed #37097 -- Made Query.clear_ordering() clear ordering on combined ↵Jacob Walls
queries also. Thanks Shai Berger for the report. Regression in 087bb9e8f3478d53f12b1737af865992af17c5f2. (That commit drove more traffic into an error that would have been reachable only with an explicit order_by() after each union().) Co-authored-by: Simon Charette <charettes@gmail.com> Co-authored-by: siddus <dcsid10@gmail.com>
2026-05-11Refs #36938 -- Tolerated unnecessary ordering in compound queries on SQLite.Jacob Walls
2026-05-11Fixed #36938 -- Removed unnecessary ordering from compound queries.siddus
2026-05-11Fixed #36593 -- Deprecated QuerySet.select_related() with no arguments.Adam Johnson
This commit deprecates the "fetch all relations" form of `QuerySet.select_related()` due to its poor performance characteristics, and updates several tests relying on that feature to ignore the new warning.
2026-05-07Fixed #37060 -- Propagated AlterField through attname-based to_field references.Andrea Zanotto
Schema dependency discovery treated to_field values as raw field names, so attname aliases such as "primary_id" were not matched to the underlying relation field "primary". As a result, AlterField on a unique target field updated direct dependencies but missed transitive attname-based references. Resolved the dependency matching by comparing resolved remote fields rather than only field names, and updated SQLite's related-table rebuild path to use the same recursive dependency discovery. Added a regression test covering a transitive relation chain where ForeignKey(..., to_field="primary_id") must widen along with the unique leaf field it ultimately references.
2026-05-05Fixed #37053 -- Added validate=True to base64.b64decode() calls.Sarah Boyce
2026-04-30Fixed #37075 -- Allowed overriding the PostgreSQL pool's "check" callable.HEADmaininitial-branchRaoni Timo
Setting "check" in OPTIONS["pool"] previously raised TypeError because the PostgreSQL backend always passed check= to ConnectionPool() and unpacked **pool_options on top, regardless of CONN_HEALTH_CHECKS. The user's callable now takes precedence via setdefault(); pool_options is copied first to avoid mutating the user's settings dict.
2026-04-28Fixed #36912 -- Added connector validation to Q.create().Anna Makarudze
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2026-04-22Fixed #37057 -- Adjusted UniqueConstraint handling of UNKNOWN condition.Simon Charette
When we adjusted UNKNOWN handling for CheckConstraint in refs #33996 we assumed that all usage of Q.check would benefit from this approach. However while CHECK constraints enforcement do ignore conditions involving NULL that resolve to UNKNOWN it's not the case for other type of constraints such as UNIQUE ones. Given how UNKNOWN should be treated depends on the callers context it appears that a better strategy for COALESCE wrapping is to force them to apply it if necessary. Thanks Drew Shapiro for the report.
2026-04-22Fixed #35870 -- Made blank choice label in forms more accessible.Annabelle Wiegart
Added new constant django.db.models.fields.BLANK_CHOICE_LABEL for an accessible and translatable blank choice label in forms. Deprecated django.db.models.fields.BLANK_CHOICE_DASH constant. Added the immediately deprecated transitional setting USE_BLANK_CHOICE_DASH. Co-Authored-By: Marijke Luttekes <mail@marijkeluttekes.dev>
2026-04-20Refs #36005 -- Made OperationCategory subclass StrEnum.Clifford Gama
2026-04-19Refs #28586 -- Added DEFAULT_FETCH_MODE module constant.Jacob Walls
This is a more attractive target for alteration than all of QuerySet.__init__().
2026-04-19Fixed #37047 -- Fixed crash in Query.orderby_issubset_groupby for descending ↵Anže Pečar
and random order_by strings. Run this example: ```python User.objects.values("is_staff").annotate(latest=Max("date_joined")).order_by("-latest").count() ``` You should see the following exception: ``` django.core.exceptions.FieldError: Cannot resolve keyword '-latest' into field. ``` Regression in 2ce5cb0f7a4618dfdc5f5c10e53e2e9b9543d298.
2026-04-18Fixed #37036 -- Added missing flat=True arg in DeferredAttribute.fetch_many().garybadwal
2026-04-18Fixed #37028 -- Added BitAnd(), BitOr(), and BitXor() aggregates.Mariusz Felisiak
2026-04-16Added DatabaseFeatures.disallowed_simple_test_case_connection_methods.Tim Graham
2026-04-14Fixed #27150 -- Made base File objects truthy by default.VIZZARD-X
2026-04-03Fixed #37016 -- Avoided propagating invalid arguments from When() to Q().varunkasyap
2026-04-02Fixed #36973 -- Made fields.E348 check detect further clashes between ↵Clifford Gama
managers and related_names. Clashes were only detected for self-referential relationships, i.e. ForeignKey("self"). Refs #22977. Bug in 6888375c53476011754f778deabc6cdbfa327011. Thanks JaeHyuckSa for the thorough review!
2026-04-02Fixed #20024 -- Fixed handling of __in lookups with None in exclude().Eddy Adegnandjou
Thanks Simon Charette and Tim Graham for reviews, and Jason Hall for a prior iteration.
2026-03-24Refs #36494 -- Prevented crash in JSONField numeric lookups with expressions.Vignesh Anand
2026-03-20Fixed #36960 -- Enabled the use of psycopg 3's optimized timestamp loader.Aarni Koskela
Based on Daniele Varrazzo's comment in https://github.com/psycopg/psycopg/issues/1273#issuecomment-3986829769
2026-03-19Refs #36795 -- Deprecated SQLCompiler.quote_name_unless_alias().Simon Charette
It has been superseded with .quote_name(), which ensures aliases are always quoted.
2026-03-19Refs #36795 -- Removed unnecessary prohibits_dollar_signs_in_column_aliases ↵Simon Charette
feature flag. Now that user provided aliases are systematically quoted there is no need to disallow the usage of the dollar sign on Postgres.
2026-03-19Fixed #36795 -- Enforced quoting of all database object names.Simon Charette
This ensures all database identifiers are quoted independently of their orign and most importantly that user provided aliases through annotate() and alias() which paves the way for dropping the allow list of characters such aliases can contain. This will require adjustments to raw SQL interfaces such as RawSQL that might make reference to ORM managed annotations as these will now be quoted. The `SQLCompiler.quote_name_unless_alias` method is kept for now as an alias for the newly introduced `.quote_name` method but will be duly deprecated in a follow up commit.
2026-03-18Fixed #36987 -- Observed prepared argument in UUIDField.get_db_prep_value().Jacob Walls
This avoids two isinstance() calls per UUID value.
2026-03-16Fixed #36906 -- Handled coalescing JSON-primitive strings and JSON values on ↵Kanin Kearpimy
Oracle.
2026-03-13Fixed #36927 -- Optimized Field.deconstruct().Adam Johnson