summaryrefslogtreecommitdiff
path: root/django/db/backends
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #470 -- Added support for database defaults on fields.Ian Foote2023-05-1210-18/+155
| | | | | | | | 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-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.
* 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-052-2/+4
|
* 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-012-0/+4
| | | | self-referential subqueries if supported.
* 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.
* Fixed #16055 -- Fixed crash when filtering against char/text GenericRelation ↵David Wobrock2023-04-183-0/+21
| | | | 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 #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.
* Prevented PostgreSQL's DatabaseCreation._execute_create_test_db() from ↵Tim Graham2023-04-031-2/+1
| | | | | hiding clause-less exceptions. Regression in 3cafb783f3f711c7413ba2b8d7c8ff750bd4d6e1.
* Fixed #34421 -- Fixed QuerySet.update() on querysets in descending order by ↵hb6h0572023-03-181-0/+1
| | | | annotations.
* Fixed #34370 -- Added integer fields validation as 64-bit on SQLite.nabil-rady2023-03-081-2/+9
|
* 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.
* 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.
* Refs #31445 -- Added test for nesting QuerySet.union().Mariusz Felisiak2023-02-211-0/+10
| | | This was fixed in MySQL 8.0.31.
* Fixed #34320 -- Make sure constraints names are obtained from truncated ↵nabil-rady2023-02-151-2/+6
| | | | columns names.
* Made PostgreSQL's SchemaEditor._create_index_sql() respect the "sql" argument.Dan Glass2023-02-061-1/+1
|
* Refs #33476 -- Applied Black's 2023 stable style.David Smith2023-02-018-6/+3
| | | | | | | | 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.
* Refs #34255 -- Skipped test_group_by_nested_expression_with_params test on ↵Mariusz Felisiak2023-01-271-0/+20
| | | | | PostgreSQL when server-side binding cursors are used. Thanks Tim Graham for the review.
* Refs #34233 -- Referenced isocalendar() results by names not indexes.Mariusz Felisiak2023-01-181-2/+2
| | | isocalendar() returns a namedtuple() instead of tuple in Python 3.9+
* Fixed #34233 -- Dropped support for Python 3.8 and 3.9.Mariusz Felisiak2023-01-183-15/+5
|
* Refs #32365 -- Removed support for pytz timezones per deprecation timeline.Mariusz Felisiak2023-01-172-13/+8
|
* Fixed #34255 -- Made PostgreSQL backend use client-side parameters binding ↵Mariusz Felisiak2023-01-172-3/+26
| | | | | | | | with psycopg version 3. Thanks Guillaume Andreu Sabater for the report. Co-authored-by: Florian Apolloner <apollo13@users.noreply.github.com>
* Refs #34255 -- Bumped required psycopg version to 3.1.8.Mariusz Felisiak2023-01-171-3/+3
|
* Refs #18468 -- Used obj_description() with a catalog name on PostgreSQL.Mariusz Felisiak2023-01-121-1/+1
| | | | | | | obj_description(object oid) without a catalog name is deprecated since there is no guarantee that OIDs are unique across different system catalogs. Thanks Tim Graham for the report.
* Fixed #34176 -- Fixed grouping by ambiguous aliases.Simon Charette2023-01-092-2/+2
| | | | | | | | | | | | | | | Regression in b7b28c7c189615543218e81319473888bc46d831. Refs #31377. Thanks Shai Berger for the report and reviews. test_aggregation_subquery_annotation_values_collision() has been updated as queries that are explicitly grouped by a subquery should always be grouped by it and not its outer columns even if its alias collides with referenced table columns. This was not possible to accomplish at the time 10866a10 landed because we didn't have compiler level handling of colliding aliases.
* 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 #34200 -- Made the session role configurable on PostgreSQL.Mike Crute2023-01-031-5/+20
|
* Fixed #14094 -- Added support for unlimited CharField on PostgreSQL.Adrian Torres2022-12-283-1/+11
| | | | Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
* Fixed #18468 -- Added support for comments on columns and tables.kimsoungryoul2022-12-289-23/+166
| | | | | | | | 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 #34217 -- Fixed migration crash when removing check constraints on ↵DevilsAutumn2022-12-271-0/+2
| | | | MySQL < 8.0.16.
* Fixed #34219 -- Preserved Char/TextField.db_collation when altering column type.Mariusz Felisiak2022-12-224-65/+58
| | | | | | | 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).
* Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo2022-12-157-93/+299
| | | | | | | Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews. Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
* Refs #33308 -- Added DatabaseOperations.compose_sql() on PostgreSQL.Florian Apolloner2022-12-122-1/+9
|
* Refs #33308 -- Added psycopg_any.IsolationLevel.Florian Apolloner2022-12-122-6/+24
|
* Refs #33308 -- Added psycopg_any.sql.quote() hook.Florian Apolloner2022-12-122-7/+14
|
* Refs #33308 -- Moved psycopg2 imports to the psycopg_any module.Florian Apolloner2022-12-124-8/+10
|
* Made inspectdb used Cursor.description.display_size for CharFields' max_length.Mariusz Felisiak2022-12-084-9/+12
| | | internal_size is size for fixed-size types not for char types.
* Fixed #34201 -- Bumped minimum supported SQLite to 3.21.0.Mariusz Felisiak2022-12-082-102/+48
|
* Refs #33308 -- Modernized database wrapper in the PostgreSQL backend.Florian Apolloner2022-12-061-6/+5
| | | | | | | | | - Used connection.info instead of connection.get_parameter_status() and connection.server_info which don't exist in psycopg 3. - Set encoding using the client_encoding connection parameter instead of connection.set_client_encoding() that doesn't exist in psycopg 3. - Used the dbname connection parameter instead of deprecated alias - database.
* Removed redundant definition of DatabaseFeatures.can_release_savepoints on ↵Mariusz Felisiak2022-12-051-1/+0
| | | | MySQL.
* Refs #33308 -- Used psycopg's errors instead of errorcodes.Florian Apolloner2022-12-011-2/+3
|
* Refs #31169 -- Skipped test_get_test_db_clone_settings_not_supported on not ↵Mariusz Felisiak2022-11-281-0/+5
| | | | | | in-memory SQLite database. multiprocessing's start method is checked only for in-memory SQLite databases.
* Fixed #34103 -- Fixed logging SQL queries with duplicate parameters on Oracle.David Sanders2022-11-251-8/+8
|
* Used DatabaseFeatures.django_test_skips to skip ↵Christophe Baldy2022-11-241-0/+5
| | | | AssertNumQueriesUponConnectionTests tests.
* Fixed #29062 -- Prevented possibility of database lock when using ↵baldychristophe2022-11-241-0/+10
| | | | | | LiveServerTestCase with in-memory SQLite database. Thanks Chris Jerdonek for the implementation idea.