summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #470 -- Added support for database defaults on fields.Ian Foote2023-05-122-5/+31
| | | | | | | | Special thanks to Hannes Ljungberg for finding multiple implementation gaps. Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for reviews.
* Fixed #34553 -- Fixed improper % escaping of literal in constraints.Simon Charette2023-05-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | 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 #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 #33759 -- Avoided unnecessary subquery in QuerySet.delete() with ↵4the4ryushin2023-05-011-0/+1
| | | | self-referential subqueries if supported.
* Fixed #34421 -- Fixed QuerySet.update() on querysets in descending order by ↵hb6h0572023-03-181-0/+1
| | | | annotations.
* Refs #34320 -- Stopped recreating check constraints when renaming fields.Mariusz Felisiak2023-03-021-0/+13
| | | | | 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.
* Refs #31445 -- Added test for nesting QuerySet.union().Mariusz Felisiak2023-02-211-0/+10
| | | This was fixed in MySQL 8.0.31.
* Refs #33476 -- Applied Black's 2023 stable style.David Smith2023-02-011-1/+0
| | | | | | | | Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
* Fixed #34304 -- Made MySQL's SchemaEditor.remove_constraint() don't create ↵sag᠎e2023-01-311-1/+4
| | | | | foreign key index when unique constraint is ignored. Regression in b731e8841558ee4caaba766c83f34ea9c7004f8b.
* Fixed #34255 -- Made PostgreSQL backend use client-side parameters binding ↵Mariusz Felisiak2023-01-171-0/+10
| | | | | | | | with psycopg version 3. Thanks Guillaume Andreu Sabater for the report. Co-authored-by: Florian Apolloner <apollo13@users.noreply.github.com>
* Refs #32355 -- Bumped mysqlclient requirement to >= 1.4.3.Mariusz Felisiak2023-01-051-2/+2
| | | mysqlclient 1.4.3 is the first release to support Python 3.8.
* Fixed #18468 -- Added support for comments on columns and tables.kimsoungryoul2022-12-283-7/+33
| | | | | | | | Thanks Jared Chung, Tom Carrick, David Smith, Nick Pope, and Mariusz Felisiak for reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Nick Pope <nick@nickpope.me.uk>
* Fixed #34219 -- Preserved Char/TextField.db_collation when altering column type.Mariusz Felisiak2022-12-221-4/+7
| | | | | | | This moves setting a database collation to the column type alteration as both must be set at the same time. This should also avoid another layer of the column type alteration when adding database comments support (#18468).
* Made inspectdb used Cursor.description.display_size for CharFields' max_length.Mariusz Felisiak2022-12-081-1/+2
| | | internal_size is size for fixed-size types not for char types.
* Removed redundant definition of DatabaseFeatures.can_release_savepoints on ↵Mariusz Felisiak2022-12-051-1/+0
| | | | MySQL.
* Refs #33374 -- Adjusted full match condition handling.Simon Charette2022-11-071-5/+9
| | | | | | Adjusting WhereNode.as_sql() to raise an exception when encoutering a full match just like with empty matches ensures that all case are explicitly handled.
* Fixed #31331 -- Switched MySQL to group by selected primary keys.Simon Charette2022-11-071-13/+1
| | | | | | MySQL 5.7.15 supports group by functional dependences so there is no need to special case group by main table primary key anymore and special case the ONLY_FULL_GROUP_BY sql mode.
* Fixed DatabaseFeatures.supports_select_(intersection/difference) on MariaDB ↵Mariusz Felisiak2022-10-251-2/+9
| | | | and MySQL 8.0.31+.
* Fixed #34070 -- Added subsecond support to Now() on SQLite and MySQL.Lily Foote2022-10-031-1/+1
|
* Fixed #31335 -- Fixed removing composed composed Meta constraints/indexes on ↵Sergey Fursov2022-09-131-7/+48
| | | | foreign keys on MySQL.
* Refs #31335 -- Added SchemaEditor._create_missing_fk_index() on MySQL.Sergey Fursov2022-09-121-6/+17
|
* Refs #28333 -- Added partial support for filtering against window functions.Simon Charette2022-08-151-4/+7
| | | | | | | | | | | | | | | | | | | | Adds support for joint predicates against window annotations through subquery wrapping while maintaining errors for disjointed filter attempts. The "qualify" wording was used to refer to predicates against window annotations as it's the name of a specialized Snowflake extension to SQL that is to window functions what HAVING is to aggregates. While not complete the implementation should cover most of the common use cases for filtering against window functions without requiring the complex subquery pushdown and predicate re-aliasing machinery to deal with disjointed predicates against columns, aggregates, and window functions. A complete disjointed filtering implementation should likely be deferred until proper QUALIFY support lands or the ORM gains a proper subquery pushdown interface.
* Fixed collation tests on MySQL 8.0.30+.Mariusz Felisiak2022-07-271-4/+7
| | | The utf8_ collations are renamed to utf8mb3_* on MySQL 8.0.30+.
* Refs CVE-2022-34265 -- Unified DatabaseOperations._convert_*_to_tz() hook names.Mariusz Felisiak2022-07-091-7/+7
|
* Fixed #33718 -- Dropped support for MySQL 5.7.Mariusz Felisiak2022-07-082-59/+5
|
* Refs CVE-2022-34265 -- Properly escaped Extract() and Trunc() parameters.Simon Charette2022-07-061-59/+58
| | | | Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
* Refs #33713 -- Removed unnecessary skip for MariaDB 10.3.Mariusz Felisiak2022-06-271-7/+3
|
* Fixed #33796 -- Fixed ordered combined queryset crash when used in subquery ↵Mariusz Felisiak2022-06-271-0/+19
| | | | | | | | on PostgreSQL and MySQL. Thanks Shai Berger for the report. Regression in 30a01441347d5a2146af2944b29778fa0834d4be.
* Fixed #28897 -- Fixed QuerySet.update() on querysets ordered by annotations.David Wobrock2022-06-171-0/+1
|
* Refs #28897 -- Added test for QuerySet.update() on querysets ordered by ↵David Wobrock2022-06-171-0/+5
| | | | inline m2m annotation.
* Fixed #32234 -- Made inspectdb inform about composite primary keys.Anv3sh2022-06-011-0/+7
|
* Fixed #33715 -- Allowed keyboard interrupt to abort queries in MySQL dbshell.Hasan Ramezani2022-05-201-0/+12
|
* Fixed #33713 -- Dropped support for MariaDB 10.3.Mariusz Felisiak2022-05-182-11/+8
|
* Refs #33379 -- Fixed minimum supported version of MariaDB.Mariusz Felisiak2022-05-171-1/+1
|
* Refs #27064 -- Added RenameIndex migration operation.David Wobrock2022-05-122-0/+7
|
* Fixed DatabaseFeatures.uses_savepoints/can_release_savepoints and related ↵Mariusz Felisiak2022-04-181-0/+3
| | | | tests with MyISAM storage engine.
* Fixed DatabaseFeatures.supports_index_column_ordering and related tests with ↵Mariusz Felisiak2022-04-131-0/+2
| | | | MyISAM storage engine.
* Fixed DatabaseFeatures.supports_expression_indexes on MySQL with MyISAM.Mariusz Felisiak2022-04-121-0/+1
|
* Refs #30581 -- Fixed DatabaseFeatures.bare_select_suffix on MySQL < 8 and ↵Gagaro2022-03-221-0/+11
| | | | MariaDB < 10.4.
* Fixed #29865 -- Added logical XOR support for Q() and querysets.Ryan Heard2022-03-041-0/+1
|
* Fixed #33508 -- Fixed DatabaseFeatures.supports_index_column_ordering on ↵Alokik Vijay2022-02-261-4/+3
| | | | MariaDB 10.8+.
* Fixed #33379 -- Added minimum database version checks.Hasan Ramezani2022-02-182-0/+11
| | | | Thanks Tim Graham for the review.
* Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak2022-02-075-20/+39
|
* Refs #33476 -- Reformatted code with Black.django-bot2022-02-079-496/+685
|
* Refs #33476 -- Refactored problematic code before reformatting by Black.Mariusz Felisiak2022-02-033-14/+29
| | | | | | | | | | | | | | | | | In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], )
* Fixed #31685 -- Added support for updating conflicts to QuerySet.bulk_create().sean_c_hsu2022-01-192-2/+30
| | | | | Thanks Florian Apolloner, Chris Jerdonek, Hannes Ljungberg, Nick Pope, and Mariusz Felisiak for reviews.
* Updated various links to HTTPS and new locations.Mariusz Felisiak2021-12-021-1/+1
| | | | Co-Authored-By: Nick Pope <nick@nickpope.me.uk>
* Fixed #33279 -- Fixed handling time zones with "-" sign in names.Can Sarigol2021-11-121-5/+3
| | | | | | Thanks yakimka for the report. Regression in fde9b7d35e4e185903cc14aa587ca870037941b1.
* Removed DatabaseIntrospection.get_key_columns().Mariusz Felisiak2021-11-102-18/+9
| | | Thanks Simon Charette for the report.
* Fixed DatabaseIntrospection.get_relations() docstring.Tim Graham2021-11-101-1/+1
| | | The foreign keys are "in" the given table, not "to" it.