summaryrefslogtreecommitdiff
path: root/django/db
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #34570 -- Silenced noop deferral of many-to-many and GFK.Simon Charette2023-05-171-1/+9
| | | | | | | | | While deferring many-to-many and GFK has no effect, the previous implementation of QuerySet.defer() ignore them instead of crashing. Regression in b3db6c8dcb5145f7d45eff517bcd96460475c879. Thanks Paco Martínez for the report.
* Fixed #34539 -- Restored get_prep_value() call when adapting JSONFields.Julie Rymer2023-05-161-0/+2
| | | | Regression in 5c23d9f0c32f166c81ecb6f3f01d5077a6084318.
* Fixed #470 -- Added support for database defaults on fields.Ian Foote2023-05-1217-22/+271
| | | | | | | | Special thanks to Hannes Ljungberg for finding multiple implementation gaps. Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for reviews.
* Fixed #34558 -- Fixed QuerySet.bulk_create() crash with Now() on Oracle.Mariusz Felisiak2023-05-111-0/+5
|
* Fixed #34553 -- Fixed improper % escaping of literal in constraints.Simon Charette2023-05-103-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Proper escaping of % in string literals used when defining constaints was attempted (a8b3f96f6) by overriding quote_value of Postgres and Oracle schema editor. The same approach was used when adding support for constraints to the MySQL/MariaDB backend (1fc2c70). Later on it was discovered that this approach was not appropriate and that a preferable one was to pass params=None when executing the constraint creation DDL to avoid any form of interpolation in the first place (42e8cf47). When the second patch was applied the corrective of the first were not removed which caused % literals to be unnecessary doubled. This flew under the radar because the existings test were crafted in a way that consecutive %% didn't catch regressions. This commit introduces an extra test for __exact lookups which highlights more adequately % doubling problems but also adjust a previous __endswith test to cover % doubling problems (%\% -> %%\%%). Thanks Thomas Kolar for the report. Refs #32369, #30408, #30593.
* Fixed #34554 -- Fixed Reverse(Value(…)) crash on Oracle.Mariusz Felisiak2023-05-101-1/+2
|
* Removed obsolete docstring from Field.db_returning.Lily Foote2023-05-101-4/+1
| | | | It's also supported on SQLite 3.35+ and MariaDB 10.5+.
* Refs #34534 -- Reduced Add/RemoveConstraint and Add/RenameIndex operations ↵Akash Kumar Sen2023-05-091-0/+12
| | | | when optimizing migrations.
* Moved SQLite DatabaseSchemaEditor.add_field()'s comment to the correct line.Mariusz Felisiak2023-05-091-2/+1
|
* Fixed #34544 -- Avoided DBMS_LOB.SUBSTR() wrapping with IS NULL condition on ↵Mariusz Felisiak2023-05-082-7/+6
| | | | | | | | | Oracle. Regression in 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca. Thanks Michael Smith for the report. This also reverts commit 1e4da439556cdd69eb9f91e07f99cf77997e70d2.
* Refs #27236 -- Made more cosmetic edits to Meta.index_together deprecation.Mariusz Felisiak2023-05-053-4/+5
|
* Fixed #34529, Refs #34525 -- Reduced index operations with ↵Mariusz Felisiak2023-05-031-0/+65
| | | | | | | | Meta.indexes/index_together when optimizing migrations. This makes squashing migrations an available path for changing Meta.index_together, which is deprecated, to Meta.indexes. Follow up to f81032572107846922745b68d5b7191058fdd5f5.
* Fixed #34523 -- Fixed TransactionManagementError in ↵Mariusz Felisiak2023-05-031-3/+0
| | | | | | | | | | | | | | QuerySet.update_or_create() with MyISAM storage engine. QuerySet.update_or_create() uses nested atomic to handle possible integrity errors taking savepoints as way to mark back the connection as usable. Savepoints are not returned when uses_savepoints/can_release_savepoints feature flags are set to False. As a consequence, QuerySet.update_or_create() assumed the outer atomic block is tainted and raised TransactionManagementError. This commit partly reverts 331a460f8f2e4f447b68fba491464b68c9b21fd1. Thanks gatello-s for the report.
* Fixed #34517 -- Avoided connection post_init signal to ImageField without ↵Orhan Hirsch2023-05-031-5/+4
| | | | width/height fields.
* Refs #31369 -- Improved hint message in NullBooleanField's deprecation warning.Paul Brown2023-05-021-1/+1
|
* Fixed #34528 -- Reduced Add/RemoveIndex operations when optimizing migrations.Mariusz Felisiak2023-05-011-0/+5
|
* Fixed #33759 -- Avoided unnecessary subquery in QuerySet.delete() with ↵4the4ryushin2023-05-013-1/+8
| | | | self-referential subqueries if supported.
* Refs #33766 -- Removed sql.Query.build_filtered_relation_q().Simon Charette2023-04-242-32/+15
| | | | It was a copy of sql.Query._add_q that avoided JOIN updates.
* Refs #33766 -- Removed unused Join.equals().Simon Charette2023-04-241-7/+0
| | | | | It's unused now that the specialized FilteredRelation.as_sql logic is no more.
* Fixed #33766 -- Resolved FilteredRelation.condition at referencing time.Simon Charette2023-04-243-48/+58
| | | | | | | | | | | The previous implementation resolved condition at Join compilation time which required introducing a specialized expression resolving mode to alter the join reuse logic solely during that phase. FilteredRelation.condition is now resolved when the relation is first referenced which maintains the existing behavior while allowing the removal of the specialized resolving mode and address an issue where conditions couldn't spawn new joins.
* Fixed #34505 -- Skipped varchar_pattern_ops/text_pattern_ops index creation ↵Petter Friberg2023-04-211-1/+3
| | | | when db_collation is set in related field.
* Refs #16055 -- Deprecated ↵David Wobrock2023-04-183-0/+31
| | | | get_joining_columns()/get_reverse_joining_columns() methods.
* Fixed #16055 -- Fixed crash when filtering against char/text GenericRelation ↵David Wobrock2023-04-186-11/+54
| | | | relation on PostgreSQL.
* Fixed #34486 -- Fixed DatabaseOperations.compose_sql() crash with no ↵Scott Macpherson2023-04-141-1/+2
| | | | | | existing database connection on PostgreSQL. Regression in 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca.
* Fixed #34480 -- Fixed crash of annotations with Chr().Jacob Walls2023-04-111-0/+1
|
* Fixed #34470 -- Enforced UTF-8 encoding on PostgreSQL.Mariusz Felisiak2023-04-071-1/+1
| | | Regression in 6a2165816394ab4bb259f6171e82417e098e97a6.
* Fixed #34466 -- Reallowed setting cursor_factory in DATABASES["options"] on ↵Anders Kaseorg2023-04-071-9/+8
| | | | | | PostgreSQL. Regression in 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca.
* Fixed #34464 -- Fixed queryset aggregation over group by reference.Simon Charette2023-04-071-0/+3
| | | | | | | | Regression in 59bea9efd2768102fc9d3aedda469502c218e9b7. Refs #28477. Thanks Ian Cubitt for the report.
* Fixed #34458 -- Fixed QuerySet.defer() crash on attribute names.Simon Charette2023-04-051-1/+2
| | | | | | Thanks Andrew Cordery for the report. Regression in b3db6c8dcb5145f7d45eff517bcd96460475c879.
* Fixed #34450 -- Fixed multi-valued JOIN reuse when filtering by expressions.Simon Charette2023-04-041-1/+1
| | | | Thanks Roman Odaisky for the report.
* Prevented PostgreSQL's DatabaseCreation._execute_create_test_db() from ↵Tim Graham2023-04-031-2/+1
| | | | | hiding clause-less exceptions. Regression in 3cafb783f3f711c7413ba2b8d7c8ff750bd4d6e1.
* Fixed #34443 -- Fixed filtering by transforms on reverse relations.Mariusz Felisiak2023-03-281-0/+6
| | | Regression in ce6230aa976e8d963226a3956b45a8919215dbd8.
* Refs #29799 -- Added field instance lookups to suggestions in FieldErrors.Mariusz Felisiak2023-03-281-1/+1
| | | Bug in cd1afd553f9c175ebccfc0f50e72b43b9604bd97.
* Fixed #34437 -- Made values() resolving error mention selected annotations.Simon Charette2023-03-251-5/+10
| | | | | While the add_fields() call from set_values() does trigger validation it does so after annotations are masked resulting in them being excluded from the choices of valid options surfaced through a FieldError.
* Fixed #28553 -- Fixed annotation mismatch with ↵David Wobrock2023-03-241-6/+11
| | | | | | QuerySet.values()/values_list() on compound queries. Co-authored-by: Matthias Kestenholz <mk@feinheit.ch>
* Fixed #34388 -- Allowed using choice enumeration types directly on model and ↵T. Franzel2023-03-211-0/+3
| | | | form fields.
* Fixed some typos in comments, docstrings, and tests.Liyang Zhang2023-03-201-1/+1
|
* Fixed #34420 -- Corrected the order of imports in generated migration files.Andy Chosak2023-03-201-1/+4
|
* Fixed #34421 -- Fixed QuerySet.update() on querysets in descending order by ↵hb6h0572023-03-182-1/+9
| | | | annotations.
* Refs #28329 -- Fixed Cast() with ForeignKey to integer fields on MySQL.David Wobrock2023-03-141-0/+3
|
* Fixed #34333 -- Fixed migration operations ordering when adding ↵Durval Carvalho2023-03-101-0/+20
| | | | | | index/constraint on new foreign key. Thanks Simon Charette and David Wobrock for reviews.
* Fixed #27397 -- Prevented integer overflows on integer field lookups.Simon Charette2023-03-091-4/+39
| | | | | This prevents a sqlite3 crash and address a potential DDoS vector on PostgreSQL caused by full-table-scans on overflows.
* Fixed #34370 -- Added integer fields validation as 64-bit on SQLite.nabil-rady2023-03-081-2/+9
|
* Fixed #34378 -- Made QuerySet.in_bulk() not clear odering when id_list is ↵Ekaterina Vahrusheva2023-03-031-2/+2
| | | | | | passed. This reverts 340eaded4e30cf25bcd4e9781d33a617fe9c0f84.
* Refs #34320 -- Stopped recreating check constraints when renaming fields.Mariusz Felisiak2023-03-022-2/+28
| | | | | This also fixes test_rename_field_with_check_to_truncated_name() on MariaDB 10.5.2+ as ALTER TABLE ... RENAME COLUMN statement doesn't rename inline constraints.
* Fixed #34368 -- Made subquery raise NotSupportedError when referencing outer ↵Simon Charette2023-02-272-1/+6
| | | | | | | | window expression. Regression in f387d024fc75569d2a4a338bfda76cc2f328f627. Co-authored-by: Jannis Vajen <jvajen@gmail.com>
* Fixed #34372 -- Fixed queryset crash on order by aggregation using OrderBy.Simon Charette2023-02-271-0/+2
| | | | | | Regression in 278881e37619278789942513916acafaa88d26f3 caused by a lack of expression copying when an OrderBy expression is explicitly provided. Thanks Jannis Vajen for the report and regression test.
* Fixed #34366 -- Reduced AlterField operations when optimizing migrations.Laurent Tramoy2023-02-241-3/+3
|
* Refs #30060, Refs #34217 -- Made SchemaEditor not generate SQL for ↵Mariusz Felisiak2023-02-231-0/+2
| | | | | | | | CheckConstraint if not supported. The new logic mirrors the logic in SchemaEditor._delete_check_sql() added in 68ef274bc505cd44f305c03cbf84cf08826200a8. Thanks Tim Graham for the report.
* Fixed #34338 -- Allowed customizing code of ValidationError in ↵Xavier Fernandez2023-02-231-11/+51
| | | | BaseConstraint and subclasses.