Nick Pope
fa35c8bdbc
Fixed #30934 -- Included database alias in django.db.backends log messages.
...
This is useful when working with database routing as you want to know
where each query is being executed.
Co-authored-by: David Winterbottom <david.winterbottom@gmail.com>
2021-07-02 15:36:53 +02:00
Mariusz Felisiak
1f643c28b5
Fixed #32653 -- Made quoting names in the Oracle backend consistent with db_table.
2021-04-30 12:59:07 +02:00
Konstantin Alekseev
6e742dabc9
Fixed #32687 -- Restored passing process’ environment to underlying tool in dbshell on PostgreSQL.
...
Regression in bbe6fbb876
.
2021-04-27 10:43:35 +02:00
Mariusz Felisiak
f6018c1e63
Fixed #32595 -- Fixed SchemaEditor.quote_value() crash with bytes.
2021-03-30 11:42:15 +02:00
Mariusz Felisiak
3c75f1f3ca
Refs #32595 -- Added MySQL's SchemaEditor.quote_value() tests for values with Unicode chars.
2021-03-30 11:42:15 +02:00
Girish Sontakke
5388ff2a52
Fixed #32582 -- Removed unnecessary dot in names of cloned test databases on SQLite.
2021-03-25 06:37:01 +01:00
Mariusz Felisiak
83443e62d3
Optimized FkConstraintsTests.test_check_constraints by specifying a database table.
2021-03-24 12:18:00 +01:00
Mariusz Felisiak
f131841c60
Fixed #32403 -- Fixed re-raising DatabaseErrors when using only 'postgres' database.
...
Thanks Kazantcev Andrey for the report.
Regression in f48f671223
.
2021-02-02 21:34:36 +01:00
Hasan Ramezani
dcb3ad3319
Fixed #32292 -- Added support for connection by service name to PostgreSQL.
2021-01-20 17:30:37 +01:00
Mariusz Felisiak
d992f4e3c2
Refs #31369 -- Removed models.NullBooleanField per deprecation timeline.
2021-01-14 17:50:04 +01:00
Hannes Ljungberg
83fcfc9ec8
Fixed #26167 -- Added support for functional indexes.
...
Thanks Simon Charette, Mads Jensen, and Mariusz Felisiak for reviews.
Co-authored-by: Markus Holtermann <info@markusholtermann.eu>
2021-01-13 11:47:50 +01:00
Mariusz Felisiak
74fd233b14
Fixed #32303 -- Bumped minimum supported SQLite to 3.9.0.
2020-12-30 09:01:56 +01:00
Chinmoy Chakraborty
270072c4c2
Fixed #32158 -- Fixed loaddata crash on SQLite when table/column names are SQL keywords.
2020-12-28 08:57:30 +01:00
Tim Graham
1e7653117f
Refs #32178 -- Fixed test_mark_expected_failures_and_skips_call teardown.
...
Test isolation failure observed on CockroachDB and PostgreSQL.
2020-12-11 21:06:33 +01:00
Hasan Ramezani
275dd4ebba
Fixed #32178 -- Allowed database backends to skip tests and mark expected failures.
...
Co-authored-by: Tim Graham <timograham@gmail.com>
2020-12-10 18:00:57 +01:00
Mariusz Felisiak
f5e5aac59e
Fixed #32224 -- Avoided suppressing connection errors in supports_json_field on SQLite.`
...
Regression in 6789ded0a6
.
Thanks Juan Garcia Alvite for the report.
2020-11-25 12:19:45 +01:00
Hasan Ramezani
50c3ac6fa9
Fixed #31762 -- Made reloading the database for tests use the base manager.
...
Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com>
2020-11-11 08:33:30 +01:00
Simon Charette
bbe6fbb876
Refs #32061 -- Unified DatabaseClient.runshell() in db backends.
2020-10-29 22:22:58 +01:00
Martin Thoma
302caa40e4
Made small readability improvements.
2020-10-28 20:20:20 +01:00
Mariusz Felisiak
77caeaea88
Fixed #32012 -- Made test database creation sync apps models when migrations are disabled.
...
Thanks Jaap Roes for the report.
2020-09-23 10:54:04 +02:00
Mariusz Felisiak
3b8857b51a
Corrected tests.backends.sqlite.tests.Tests.test_aggregation()'s docstring.
2020-09-13 20:09:44 +02:00
Mariusz Felisiak
0be51d2226
Fixed #31956 -- Fixed crash of ordering by JSONField with a custom decoder on PostgreSQL.
...
Thanks Marc Debureaux for the report.
Thanks Simon Charette, Nick Pope, and Adam Johnson for reviews.
2020-08-28 19:09:46 +02:00
David Smith
e74b3d724e
Bumped minimum isort version to 5.1.0.
...
Fixed inner imports per isort 5.
isort 5.0.0 to 5.1.0 was unstable.
2020-07-30 10:58:59 +02:00
Mariusz Felisiak
83f55aafdd
Fixed #17653 -- Allowed using zero as AutoFields value on MySQL if NO_AUTO_VALUE_ON_ZERO SQL mode is enabled.
2020-07-20 09:48:31 +02:00
Sergey Fedoseev
dd5aa8cb5f
Fixed #28925 -- Fixed durations-only expressions crash on SQLite and MySQL.
...
This removes also unused DatabaseOperations.date_interval_sql().
2020-06-30 07:04:55 +02:00
Jon Dufresne
d6aff369ad
Refs #30116 -- Simplified regex match group access with Match.__getitem__().
...
The method has been available since Python 3.6. The shorter syntax is
also marginally faster.
2020-05-11 12:01:28 +02:00
sage
6789ded0a6
Fixed #12990 , Refs #27694 -- Added JSONField model field.
...
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael
Michel for mentoring this Google Summer of Code 2019 project and
everyone else who helped with the patch.
Special thanks to Mads Jensen, Nick Pope, and Simon Charette for
extensive reviews.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-05-08 07:23:31 +02:00
Adam Johnson
1c2c6f1b51
Fixed a/an typos in "SQL" usage.
2020-05-06 06:35:26 +02:00
Mariusz Felisiak
d5898db50e
Fixed backends.oracle.test_operations.
...
Using unittest.TestCase doesn't work properly when we perform db
queries. Moreover introspection is extremely slow on Oracle without
limiting models to a "backends" app.
Follow up to 8bcca47e83
.
2020-04-21 15:46:18 +02:00
Jon Dufresne
75866b93cc
Fixed #31479 -- Added support to reset sequences on SQLite.
2020-04-21 10:41:47 +02:00
Jon Dufresne
505fec6bad
Capitalized Unicode in docs, strings, and comments.
2020-04-20 12:10:33 +02:00
Jon Dufresne
5673d4b102
Fixed #31477 -- Removed "using" argument from DatabaseOperations.execute_sql_flush().
2020-04-20 07:49:35 +02:00
Jon Dufresne
537d422942
Simplified LongNameTest.test_sequence_name_length_limits_flush() with execute_sql_flush().
2020-04-18 20:48:30 +02:00
Jon Dufresne
75410228df
Fixed #31473 -- Made sql_flush() use RESTART IDENTITY to reset sequences on PostgreSQL.
...
The sql_flush() positional argument sequences is replaced by the boolean
keyword-only argument reset_sequences. This ensures that the old
function signature can't be used by mistake when upgrading Django. When
the new argument is True, the sequences of the truncated tables will
reset. Using a single boolean value, rather than a list, allows making a
binary yes/no choice as to whether to reset all sequences rather than a
working on a completely different set.
2020-04-17 11:57:24 +02:00
Jon Dufresne
8bcca47e83
Added test coverage for DatabaseOperations.sql_flush().
2020-04-17 09:52:43 +02:00
Mariusz Felisiak
537b0c5edf
Fixed typo in tests/backends/base/test_operations.py.
2020-04-08 20:06:31 +02:00
Matthijs Kooijman
289d0ec6fd
Refs #31051 -- Fixed reloading the database with circular related objects and natural keys for tests.
...
Made deserialize_db_from_string() do not sort dependencies.
deserialize_db_from_string() doesn't use natural keys, so there is no
need to sort dependencies in serialize_db_to_string(). Moreover,
sorting models cause issues for circular dependencies.
2020-04-02 11:35:33 +02:00
Matthijs Kooijman
12e6f573ad
Refs #26552 -- Added test for reloading the database with self-referential objects.
2020-04-02 09:17:41 +02:00
shankarj67
df4d622cac
Fixed #31345 -- Added BaseDatabaseIntrospection.get_relations().
2020-03-06 08:53:32 +01:00
aryan
427a7e419b
Fixed #31333 -- Added BaseDatabaseIntrospection.get_table_description().
2020-03-04 12:26:31 +01:00
Mariusz Felisiak
6dea42feba
Added tests for BaseDatabaseIntrospection's stub methods.
2020-03-04 12:25:17 +01:00
Mariusz Felisiak
94d4bd3a09
Fixed backends tests on Oracle.
...
Using Person in test_introspection caused removing constraints in
intermediate table for ManyToManyField in
VeryLongModelNameZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ that were
expected by other transaction tests. A model without any constraints
was used to prevent isolation issues.
2020-02-24 14:21:50 +01:00
Mariusz Felisiak
4261907ff3
Fixed tests when run in reverse.
...
Regression in 98f23a8af0
.
2020-02-19 14:48:26 +01:00
Mariusz Felisiak
2a038521c4
Fixed #31271 -- Preserved ordering when unifying query parameters on Oracle.
...
This caused misplacing parameters in logged SQL queries.
Regression in 79065b55a7
.
Thanks Hans Aarne Liblik for the report.
2020-02-18 11:45:12 +01:00
Taoup
cbb6531e5b
Fixed #31228 -- Reallowed aggregates to be used with multiple expressions and no DISTINCT on SQLite.
...
Regression in bc05547cd8
.
Thanks Andy Terra for the report.
2020-02-18 10:32:23 +01:00
Matthijs Kooijman
98f23a8af0
Fixed #26552 -- Deferred constraint checks when reloading the database with data for tests.
...
deserialize_db_from_string() loads the full serialized database
contents, which might contain forward references and cycles. That
caused IntegrityError because constraints were checked immediately.
Now, it loads data in a transaction with constraint checks deferred
until the end of the transaction.
2020-02-14 13:18:06 +01:00
Jon Dufresne
3259983f56
Fixed #31233 -- Closed database connections and cursors after use.
2020-02-06 15:35:23 +01:00
Jon Dufresne
f48f671223
Refs #31233 -- Changed DatabaseWrapper._nodb_connection to _nodb_cursor().
...
It is now a method instead of a property and returns a context manager
that yields a cursor on entry and closes the cursor and connection upon
exit.
2020-02-06 15:29:38 +01:00
Nick Pope
335c9c94ac
Simplified imports from django.db and django.contrib.gis.db.
2020-02-04 13:20:06 +01:00
Matthijs Kooijman
2a2ea4ee18
Refs #31117 -- Made various tests properly handle unexpected databases aliases.
...
- Used selected "databases" instead of django.db.connections.
- Made routers in tests.migrations skip migrations on unexpected
databases.
- Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook
which properly asserts messages about skipped databases.
2020-01-20 14:39:02 +01:00
Matthijs Kooijman
b64b1b2e1a
Fixed #31117 -- Isolated backends.base.test_creation.TestDbCreationTests.
...
Previously, this test could modify global state by changing
connection.settings_dict. This dict is a reference to the same dict as
django.db.connections.databases['default'], which is thus also changed.
The cleanup of this test would replace connection.settings_dic` with a
saved copy, which would leave the dict itself modified.
Additionally, create_test_db() would also modify these same dicts, as
well as settings.databases['default']['NAME'] by adding a "test_"
prefix, which is what can cause problems later.
This patch:
- makes a complete copy of the connection and work on that, to improve
isolation.
- calls destroy_test_db() to let that code clean up anything done by
create_test_db().
2020-01-20 11:00:17 +01:00
Mariusz Felisiak
f34be5294d
Refs #31117 -- Moved get_connection_copy() test hook to a module level.
2020-01-20 11:00:05 +01:00
Mariusz Felisiak
c159baceba
Refs #31117 -- Isolated backends.sqlite.test_creation.TestDbSignatureTests.
2019-12-31 12:09:50 +01:00
Farhaan Bukhsh
664c98f1f8
Fixed #30413 -- Fixed test database signature on SQLite when test database name is provided.
...
Previously, the same signature was created for multiple in-memory
databases on SQLite when they had tests databases names
DATABASES['TEST']['NAME'].
2019-11-21 19:50:24 +01:00
Jon Dufresne
f5ebdfce5c
Fixed #25388 -- Added an option to allow disabling of migrations during test database creation.
2019-11-20 20:42:38 +01:00
Jon Dufresne
77aa74cb70
Refs #29983 -- Added support for using pathlib.Path in all settings.
2019-11-07 10:26:22 +01:00
Johannes Hoppe
7254f1138d
Refs #29444 -- Allowed returning multiple fields from INSERT statements on PostgreSQL.
...
Thanks Florian Apolloner, Tim Graham, Simon Charette, Nick Pope, and
Mariusz Felisiak for reviews.
2019-09-09 10:51:14 +02:00
Hasan Ramezani
e3fc9af4ab
Refs #30593 -- Fixed introspection of check constraints columns on MariaDB.
2019-07-30 16:32:13 +02:00
Hasan Ramezani
b2aad9ad4d
Refs #30593 -- Added _parse_constraint_columns() hook to introspection on MariaDB.
2019-07-30 16:32:13 +02:00
Yann Sionneau
e47b8293a7
Fixed #30636 -- Fixed options ordering when cloning test database on MySQL.
...
--defaults-file must be given before other options.
2019-07-16 07:25:43 +02:00
Johannes Hoppe
bc91f27a86
Refs #29444 -- Added support for fetching a returned non-integer insert values on Oracle.
...
This is currently not actively used, since the ORM will ask the
SQL compiler to only return auto fields.
2019-07-08 08:53:08 +02:00
kingbuzzman
673fe2e3ec
Fixed #30148 -- Logged COPY ... TO statements in connection.queries on PostgreSQL.
2019-04-29 14:20:17 +02:00
Mariusz Felisiak
ed880d92b5
Added tests for queries log in CursorDebugWrapper.executemany().
2019-04-29 10:38:17 +02:00
Ville Skyttä
03db5fddfd
Fixed typos in docs, comments, and exception messages.
2019-04-18 09:33:53 +02:00
Mariusz Felisiak
79065b55a7
Refs #20010 -- Unified DatabaseOperations.last_executed_query() on Oracle with other db backends.
...
Thanks Simon Charette for the review.
2019-04-05 21:35:51 +02:00
msg
755673e1bc
Fixed #30307 -- Fixed incorrect quoting of database user password when using dbshell on Oracle.
...
Regression in acfc650f2a
.
2019-04-04 08:33:28 +02:00
Paveł Tyślacki
782d85b6df
Fixed #30183 -- Added introspection of inline SQLite constraints.
2019-03-13 10:24:28 -04:00
Tim Graham
36300ef336
Fixed a failure when running tests on systems with SQLite < 3.8.3.
2019-02-21 12:52:10 -05:00
Simon Charette
7071f8f272
Fixed #30193 , Refs #28478 -- Avoided PostgreSQL connection health checks on initialization.
...
This addressed a regression introduced by a96b901932
as identified by Ran Benita.
2019-02-20 10:59:40 +01:00
Jon Dufresne
76990cbbda
Fixed #30171 -- Fixed DatabaseError in servers tests.
...
Made DatabaseWrapper thread sharing logic reentrant. Used a reference
counting like scheme to allow nested uses.
The error appeared after 8c775391b7
.
2019-02-14 10:04:55 -05:00
Mariusz Felisiak
7d5d20212c
Simplified test_cursor_var() by using str instead of Database.STRING.
2019-02-12 20:10:02 +01:00
Sergey Fedoseev
b1a2ad6925
Removed uneeded iter() calls with generator expression as argument.
2019-02-09 09:18:22 -05:00
Tim Graham
7444f32527
Refs #30055 -- Added a helpful error when SQLite is too old.
2019-01-28 11:14:45 -05:00
Mariusz Felisiak
f05c02c4b8
Fixed #30117 -- Fixed SchemaEditor.quote_value() test for mysqlclient 1.4.0+.
2019-01-19 13:31:15 +01:00
Simon Charette
b181aba7dd
Refs #28478 -- Prevented database feature based skipping on tests disallowing queries.
...
Database features may require a connection to be established to determine
whether or not they are enabled.
2019-01-14 16:16:30 -05:00
Simon Charette
bc05547cd8
Fixed #28658 -- Added DISTINCT handling to the Aggregate class.
2019-01-09 17:52:36 -05:00
Nick Pope
83677faf86
Fixed #30056 -- Added SQLite support for StdDev and Variance functions.
2018-12-24 11:14:58 -05:00
Nick Pope
7534e43497
Refs #14204 -- Removed obsolete referential integrity comment for SQLite.
2018-12-22 18:44:21 -05:00
Simon Charette
25a0781a16
Refs #29182 -- Corrected SQLite's supports_atomic_references_rename feature flag.
2018-12-22 14:58:08 -05:00
Simon Charette
20f6f9eaa1
Renamed SQLite3 references to to SQLite.
...
The version suffix isn't part of the product name.
2018-12-22 14:20:43 -05:00
Simon Charette
894cb13779
Refs #29182 -- Stopped relying on legacy alter table semantic on SQLite 3.26+.
...
SQLite 3.26 changed the behavior of table and column renaming operations to
repoint foreign key references even if foreign key checks are disabled.
This makes the workarounds in place to simulate this behavior unnecessary on
SQLite 3.26+. Refs #30033 .
2018-12-17 10:44:05 +01:00
Simon Charette
315357ad25
Fixed #30023 -- Prevented SQLite schema alterations while foreign key checks are enabled.
...
Prior to this change foreign key constraint references could be left pointing
at tables dropped during operations simulating unsupported table alterations
because of an unexpected failure to disable foreign key constraint checks.
SQLite3 does not allow disabling such checks while in a transaction so they
must be disabled beforehand.
Thanks ezaquarii for the report and Carlton and Tim for the review.
2018-12-15 18:51:59 -05:00
Tim Graham
734ce71824
Refs #30013 -- Fixed SchemaEditor.quote_value() test for mysqlclient 1.3.14+.
2018-12-05 14:46:31 -05:00
Tim Graham
193c109327
Switched TestCase to SimpleTestCase where possible in Django's tests.
2018-11-27 08:58:44 -05:00
Mariusz Felisiak
d5f4ce9849
Fixed #29949 -- Refactored db introspection identifier converters.
...
Removed DatabaseIntrospection.table_name_converter()/column_name_converter()
and use instead DatabaseIntrospection.identifier_converter().
Removed DatabaseFeatures.uppercases_column_names.
Thanks Tim Graham for the initial patch and review and Simon Charette
for the review.
2018-11-21 09:06:50 +01:00
Tim Graham
9cac10eee4
Added BaseDatabaseSchemaEditor._effective_default() to allow testing without a connection.
2018-11-17 19:27:53 -05:00
Tim Graham
e62f6e0968
Fixed #29505 -- Removed SchemaEditor's calling of callable defaults.
...
Thanks Eugene Pakhomov for the suggested fix.
2018-11-17 19:27:53 -05:00
Mariusz Felisiak
ff8020ed49
Fixed #29788 -- Added support for Oracle Managed File (OMF) tablespaces.
2018-11-13 18:22:41 -05:00
Sergey Fedoseev
9a88c6dd6a
Fixed #29827 -- Fixed reuse of test databases with --keepdb on MySQL.
...
Regression in e1253bc26f
.
2018-10-25 19:37:41 -04:00
Jon Dufresne
7598cd4748
Fixed #29813 -- Fixed DatabaseOperation test when run in isolation on MySQL.
2018-10-02 08:22:38 -04:00
Srinivas Reddy Thatiparthy
34d6bceec4
Fixed #29500 -- Fixed SQLite function crashes on null values.
...
Co-authored-by: Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
2018-09-10 15:08:55 -04:00
Jon Dufresne
bf17f5e884
Refs #29015 -- Added database name to PostgreSQL database name too long exception.
2018-08-17 12:43:56 -04:00
Mariusz Felisiak
1a9cbf41a1
Fixed #29613 -- Fixed --keepdb on PostgreSQL if the database exists and the user can't create databases.
...
Regression in e776dd2db6
.
Thanks Tim Graham for the review.
2018-08-03 10:31:55 +02:00
Tom Forbes
45c035c823
Refs #29548 -- Fixed non-GIS test failures on MariaDB.
2018-07-09 14:59:42 -04:00
bakabiko
a7bc1aea03
Fixed #29380 -- Added support for QuerySet.select_for_update()'s nowait and skip_locked options on MySQL 8+.
2018-05-18 19:37:36 -04:00
Morgan Aubert
704443acac
Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().
2018-05-09 11:40:28 -04:00
Zackary Troop
30f8642f2e
Fixed #29350 -- Fix get_primary_key_column() method in sqlite3 backend
...
Thanks Tim Graham and Mariusz Felisiak for the reviews.
2018-04-28 12:01:45 +02:00
priyanshsaxena
6b3d292043
Fixed #29015 -- Added an exception if the PostgreSQL database name is too long.
2018-04-27 21:37:42 -04:00
Mariusz Felisiak
816b386d41
Refs #24791 -- Made PostgreSQL's nodb connection use first PostgresSQL db when 'postgres' db isn't available.
...
Thanks Tim Graham and Claude Paroz for reviews.
2018-04-03 22:21:47 +02:00
Tim Graham
5fa4f40f45
Fixed #29227 -- Allowed BooleanField to be null=True.
...
Thanks Lynn Cyrin for contributing to the patch, and Nick Pope for review.
2018-03-20 12:10:10 -04:00