Nick Pope
e626a3f993
Renamed Sqlite and Sqlite3 references to SQLite.
2018-12-22 18:52:54 -05:00
Sergey Fedoseev
a68ea23101
Fixed #29970 , #30041 -- Made ModelBase.__new__() pass attrs without contribute_to_class() to type.__new__().
2018-12-22 18:11:24 -05:00
Simon Charette
ce8b65ac5e
Fixed #30054 -- Implemented cascaded flush on SQLite.
...
This is required to maintain foreign key integrity when using
TransactionTestCase.available_apps.
Refs #30033 , #14204 , #20483 .
2018-12-22 17:47:48 -05:00
Tim Graham
d5af14aa84
Fixed #30055 -- Dropped support for SQLite < 3.8.3.
2018-12-22 16:59:28 -05:00
Simon Charette
790d108c97
Refs #30033 -- Checked constraints before committing SQLite schema changes.
...
This order of operations is more in line with SQLite's documented table
rebuild procedure and ensures that changes aren't committed if foreign key
integrity is broken.
2018-12-22 15:26:46 -05:00
Simon Charette
6b9bd0933e
Refs #29928 -- Added supports_pragma_foreign_key_check SQLite feature flag.
2018-12-22 15:14:33 -05:00
Simon Charette
f3eb1cfb58
Refs #29928 -- Corrected SQLite's can_defer_constraint_checks feature flag.
2018-12-22 15:13:46 -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
e5b8626c0e
Refs #29547 -- Corrected SQLite's supports_partial_indexes feature flag.
2018-12-22 14:51:59 -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
Dakota Hawkins
8d3147e130
Fixed #30031 -- Added --no-header option to makemigrations/squashmigrations.
2018-12-19 12:41:31 +01:00
Simon Charette
1939dd49d1
Fixed #29928 -- Enabled deferred constraint checks on SQLite 3.20+.
...
Refs #11665 , #14204 .
Thanks Michel Samia for the report.
2018-12-17 11:03:44 +01: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
7289874adc
Fixed #30033 -- Conformed to the recommended table alterations procedure on SQlite3.
...
Refs #29182 .
The previous implementation was following a procedure explicitly documented
as incorrect and was the origin of the breakage experienced on SQLite 3.26
release that were addressed by c8ffdbe514
.
Thanks to Richard Hipp for pointing out the usage of the incorrect procedure.
2018-12-17 10:44:05 +01:00
Simon Charette
a939d630a4
Refs #29928 -- Implemented fast constraint checking on SQLite 3.20+.
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
Mariusz Felisiak
f0082b9a77
Refs #28670 -- Fixed DatabaseFeatures.supports_slicing_ordering_in_compound on Oracle.
2018-12-10 12:56:09 +00:00
Simon Charette
c8ffdbe514
Fixed #29182 -- Fixed schema table alteration on SQLite 3.26+.
...
SQLite 3.26 repoints foreign key constraints on table renames even when
foreign_keys pragma is off which breaks every operation that requires
a table rebuild to simulate unsupported ALTER TABLE statements.
The newly introduced legacy_alter_table pragma disables this behavior
and restores the previous schema editor assumptions.
Thanks Florian Apolloner, Christoph Trassl, Chris Lamb for the report and
troubleshooting assistance.
2018-12-07 13:32:37 -05:00
Mariusz Felisiak
f9a33e3c3f
Fixed #29932 -- Fixed combining compound queries with sub-compound queries on SQLite and Oracle.
2018-12-06 15:31:33 -05:00
Simon Charette
53269bcaaf
Fixed #30011 -- Fixed queries that reuse filtered aggregates.
...
Thanks Taqi Abbas and Raphael Kimmig for the report.
2018-12-06 14:55:35 -05:00
Tim Graham
88619e6129
Bumped mysqlclient requirement to >= 1.3.13.
...
There are test failures with older versions.
2018-12-06 14:49:27 -05:00
Tim Graham
284b3221a2
Fixed #30013 -- Fixed DatabaseOperations.last_executed_query() with mysqlclient 1.3.14+.
2018-12-05 14:46:23 -05:00
Nick Pope
c3bbf1fd4c
Refs #28643 -- Skipped ATan2() workaround on SpatiaLite 5+.
2018-11-30 13:59:05 -05:00
Prabakaran Kumaresshan
0d724ce916
Fixed #30001 -- Marked UUIDField.description for translation.
2018-11-30 11:23:17 -05:00
Tim Fiedler
b07273a0f7
Fixed #29987 -- Detected unmanaged model deletions.
2018-11-30 09:57:43 -05:00
Mariusz Felisiak
f091ea3515
Refs #29722 -- Added introspection of materialized views for Oracle.
...
Thanks Tim Graham for the review.
2018-11-26 19:45:05 +01:00
Nick Pope
c512912463
Refs #23801 -- Made integer field max_length warning show correct field type.
2018-11-23 14:40:46 -05:00
Nick Pope
856ba1ec86
Removed redundant BigIntegerField.empty_strings_allowed (already inherited).
2018-11-23 14:22:58 -05:00
Tom Forbes
31408446b3
Fixed #29974 -- Fixed non-truthy primary key values for QuerySet.bulk_update().
2018-11-21 22:58:43 -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
acdd18dffc
Changed BaseDatabaseSchemaEditor._effective_default() to staticmethod.
...
Follow up to 9cac10eee4
.
2018-11-20 18:01:18 -05:00
Nick Pope
ebd270627c
Refs #29722 -- Added introspection of partitions for PostgreSQL.
2018-11-19 14:06:01 -05:00
Sergey Fedoseev
80ba7a881f
Fixed cached_properties that share a common property.
...
The aliases aren't cached and thus the old usage will be an error after
refs #29478 .
2018-11-19 08:59:46 -05: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
Simon Charette
0cf85e6b07
Refs #29908 -- Optimized known related objects assignment.
...
Since CPython implements a C level attrgetter(*attrs) it even outperforms the
most common case of a single known related object since the resulting attribute
values tuple is built in C.
2018-11-17 18:56:11 -05:00
Ian Foote
e1fc07c047
Fixed #17930 -- Allowed ORing (|) with sliced QuerySets.
2018-11-15 09:43:58 -05:00
Hasan Ramezani
6d4e5feb79
Fixed #29835 -- Made RelatedFieldListFilter respect ModelAdmin.ordering.
2018-11-14 14:29:39 -05:00
Mariusz Felisiak
ff8020ed49
Fixed #29788 -- Added support for Oracle Managed File (OMF) tablespaces.
2018-11-13 18:22:41 -05:00
Simon Charette
db13bca60a
Fixed #29641 -- Added support for unique constraints in Meta.constraints.
...
This constraint is similar to Meta.unique_together but also allows
specifying a name.
Co-authored-by: Ian Foote <python@ian.feete.org>
2018-11-13 17:57:27 -05:00
Simon Charette
dba4a634ba
Refs #29641 -- Refactored database schema constraint creation.
...
Added a test for constraint names in the database.
Updated SQLite introspection to use sqlparse to allow reading the
constraint name for table check and unique constraints.
Co-authored-by: Ian Foote <python@ian.feete.org>
2018-11-13 15:25:44 -05:00
Tim Graham
f82be9ebc7
Fixed #29934 -- Added sqlparse as a require dependency.
2018-11-09 19:09:36 -05:00
Srinivas Reddy Thatiparthy
978ad6d4c0
Removed unused 'tz' variable in typecast_timestamp().
2018-11-09 12:47:02 -05:00
Simon Charette
75dfa92a05
Fixed #29908 -- Fixed setting of foreign key after related set access if ForeignKey uses to_field.
...
Adjusted known related objects handling of target fields which relies on
from and to_fields and has the side effect of fixing a bug bug causing
N+1 queries when using reverse foreign objects.
Thanks Carsten Fuchs for the report.
2018-11-08 19:51:15 -05:00
Tom Forbes
d5e52f2bef
Removed DatabaseOperation.savepoint_create/rollback_sql() on Oracle.
...
Obsolete since 918f44e3ae
.
2018-11-04 18:21:59 -05:00
Jayantha Gumballi
dfcdc8992f
Fixed #29886 -- Fixed unaccent lookup when PostgreSQL's standard_conforming_strings option is off.
...
Thanks Tom McClure for the patch.
2018-11-01 11:14:34 -04:00
Mads Jensen
a906c98982
Fixed #29547 -- Added support for partial indexes.
...
Thanks to Ian Foote, Mariusz Felisiak, Simon Charettes, and
Markus Holtermann for comments and feedback.
2018-10-29 19:34:54 -04:00
thomazzo
9625d13f7b
Fixed #29882 -- Added events and stored routines to MySQL's cloned test databases.
2018-10-29 14:45:30 -04:00
Simon Charette
d8e03fdeb9
Fixed #29897 -- Fixed autodetector's swappable MTI dependency resolution.
...
Thanks Steven Ganz for the detailed report.
2018-10-29 11:24:30 -04:00
Simon Charette
82353ef940
Refs #29897 -- Moved autodetector swappable dependency resolution to a method.
2018-10-29 11:17:21 -04:00
Simon Charette
f1855fd885
Refs #23322 -- Removed unnecessary "and" clause in the autodetector.
...
If the depedency was swappable then it'll be resolved at this point.
2018-10-29 11:07:07 -04:00
Simon Charette
95bda03f2d
Fixed #29868 -- Retained database constraints on SQLite table rebuilds.
...
Refs #11964 .
Thanks Scott Stevens for testing this upcoming feature and the report.
2018-10-29 10:33:41 +01:00
Tim Graham
f77fc56c96
Fixed #29896 -- Fixed incorrect Model.save() cache relation clearing for foreign keys that use to_field.
...
Regression in ee49306176
.
2018-10-28 22:54:02 -04:00
Hampus Dunström
5e8a07d69d
Fixed #29763 -- Added support for column renaming on SQLite.
2018-10-27 20:26:39 -04:00
Tim Graham
717ee63e56
Refs #27025 -- Removed obsolete sqlite3 transaction management workaround for Python 3.6+.
...
Obsolete per https://bugs.python.org/issue10740#msg274816 .
2018-10-25 19:54:48 -04:00
Mariusz Felisiak
c6525bea9e
Fixed #29534 -- Made dbshell use rlwrap on Oracle if available.
2018-10-25 19:39:42 -04: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
Tim Graham
f1d1634493
Removed useless check in sqlite's DatabaseWrapper._savepoint_allowed().
...
Obsolete since 27193aea00
.
2018-10-25 10:17:37 -04:00
Tim Graham
9b52bd6575
Made DatabaseFeatures.uses_savepoints default to True.
2018-10-25 10:02:47 -04:00
Sanyam Khurana
83c7096f2a
Fixed #29869 -- Made UUIDField.to_python() convert integers.
2018-10-24 20:26:57 -04:00
Sanyam Khurana
c86a3d80a2
Fixed #29721 -- Ensured migrations are applied and recorded atomically.
2018-10-24 19:29:11 -04:00
Mariusz Felisiak
641742528a
Fixed F841 flake8 warning.
2018-10-24 09:13:10 -04:00
Simon Charette
5e3463f6bc
Fixed #27595 -- Made ForeignKey.get_col() follow target chains.
...
Previously, foreign relationships were followed only one level deep which
prevents foreign keys to foreign keys from being resolved appropriately.
This was causing issues such as improper database value conversion for
UUIDField on SQLite because the resolved expression's output field's
internal type wasn't correct. Added tests to make sure unlikely foreign
reference cycles don't cause recursion errors.
Refs #24343 .
Thanks oyooyo for the report and Wayne Merry for the investigation.
2018-10-22 09:49:34 -04:00
Mariusz Felisiak
328f5627dd
Fixed #29870 -- Added DurationField introspection for Oracle and PostgreSQL.
...
Thanks Tim Graham for the review.
2018-10-21 09:08:05 +02:00
aspalding
834c4ec8e4
Moved make_hashable() to django.utils and added tests.
2018-10-17 11:17:23 -04:00
Florian Apolloner
bc7dd8490b
Fixed #21171 -- Avoided starting a transaction when a single (or atomic queries) are executed.
...
Checked the following locations:
* Model.save(): If there are parents involved, take the safe way and use
transactions since this should be an all or nothing operation.
If the model has no parents:
* Signals are executed before and after the previous existing
transaction -- they were never been part of the transaction.
* if `force_insert` is set then only one query is executed -> atomic
by definition and no transaction needed.
* same applies to `force_update`.
* If a primary key is set and no `force_*` is set Django will try an
UPDATE and if that returns zero rows it tries an INSERT. The first
case is completly save (single query). In the second case a
transaction should not produce different results since the update
query is basically a no-op then (might miss something though).
* QuerySet.update(): no signals issued, single query -> no transaction
needed.
* Model/Collector.delete(): This one is fun due to the fact that is
does many things at once.
Most importantly though: It does send signals as part of the
transaction, so for maximum backwards compatibility we need to be
conservative.
To ensure maximum compatibility the transaction here is removed only
if the following holds true:
* A single instance is being deleted.
* There are no signal handlers attached to that instance.
* There are no deletions/updates to cascade.
* There are no parents which also need deletion.
2018-10-17 12:19:02 +02:00
oliver
1299421cad
Fixed #29725 -- Removed unnecessary join in QuerySet.count() and exists() on a many-to-many relation.
2018-10-15 11:01:57 -04:00
Mariusz Felisiak
f2e2a1bd4b
Fixed #29845 -- Fixed Cast crash on MySQL when casting to DecimalField.
2018-10-15 15:57:22 +02:00
Mariusz Felisiak
a3052c35d1
Fixed various comments in django/db/backends/oracle/base.py.
2018-10-13 20:25:23 +02:00
Patrik Sletmo
adfdb9f169
Fixed #29814 -- Added support for NoneType serialization in migrations.
2018-10-11 09:02:14 -04:00
Mariusz Felisiak
52fec5d18f
Fixed #29836 -- Bumped required cx_Oracle to 6.0.
2018-10-11 11:43:16 +02:00
Sergey Fedoseev
3957f767bb
Simplified handling of DurationField values on MySQL/MariaDB.
2018-10-09 10:38:42 -04:00
Jon Dufresne
e90af8bad4
Capitalized "Python" in docs and comments.
2018-10-09 09:26:07 -04:00
Jon Dufresne
1e87c9fe71
Replaced kwargs.pop() with keyword-only arguments.
2018-10-08 15:06:02 -04:00
Jon Dufresne
2ba588e773
Refs #27795 -- Removed force_text() usage in db/models/sql/query.py.
2018-10-08 14:47:01 -04:00
Jon Dufresne
efd8a82e26
Refs #27795 -- Removed force_bytes() usage in MySQL backend.
...
The mysqlclient cursor attribute `_last_executed` is always stored as
bytes. Decode it.
TextField values are already type str. No need to decode.
2018-10-03 10:37:36 +02:00
Simon Charette
bc7e288ca9
Fixed #29745 -- Based Expression equality on detailed initialization signature.
...
The old implementation considered objects initialized with an equivalent
signature different if some arguments were provided positionally instead of
as keyword arguments.
Refs #11964 , #26167 .
2018-10-02 19:15:20 -04:00
Nick Pope
bf8b625a3b
Refs #29722 -- Added introspection of materialized views for PostgreSQL.
2018-10-02 14:02:04 -04:00
Nick Pope
45ef3df7d0
Fixed #29719 -- Added introspection of foreign tables for PostgreSQL.
...
Thanks infinite-l00p for the initial patch.
2018-10-02 14:01:24 -04:00
Simon Charette
24dc7d8940
Refs #29641 -- Extracted reusable CheckConstraint logic into a base class.
2018-10-02 13:11:18 -04:00
Simon Charette
9142bebff2
Refs #11964 -- Changed CheckConstraint() signature to use keyword-only arguments.
...
Also renamed the `constraint` argument to `check` to better represent which
part of the constraint the provided `Q` object represents.
2018-10-02 10:53:04 -04:00
Jon Dufresne
0bf7b25f8f
Added django.db.backends.utils.names_digest() to remove redundant code.
2018-10-02 10:41:43 -04:00
Jon Dufresne
c37b844349
Fixed ResourceWarning in MySQL's _clone_test_db().
2018-10-02 10:23:21 -04:00
Abhinav Patil
bf01994a5c
Fixed #29804 -- Added 'did you mean' suggestions for unsupported lookup error.
2018-10-01 19:03:10 -04:00
Claude Paroz
fc3a463048
Fixed #29767 -- Made date-related casts work on SQLite
...
Thanks Rémy Hubscher for the report and Tim Graham and Simon Charette for the reviews.
2018-10-01 13:27:30 +02:00
Sergey Fedoseev
8ef8bc0f64
Refs #28909 -- Simplifed code using unpacking generalizations.
2018-09-28 09:57:12 -04:00
Mariusz Felisiak
024abe5b82
Fixed #29630 -- Fixed crash of sliced queries with multiple columns with the same name on Oracle 12.1.
...
Regression in 0899d583bd
.
Thanks Tim Graham for the review and Jani Tiainen for help.
2018-09-26 20:18:48 +02:00
Mariusz Felisiak
90d93a1b42
Made DatabaseWrapper.oracle_version() return a full version tuple.
2018-09-26 08:51:27 +02:00
Jon Dufresne
82f286cf6f
Refs #29784 -- Switched to https:// links where available.
2018-09-26 08:48:47 +02:00
Oleg
d1d5c97bc2
Fixed #29778 -- Fixed quoting of unique index names.
...
Regression in 3b429c9673
.
2018-09-25 16:00:20 -04:00
Jon Dufresne
8c3e0eb1c1
Normalized spelling of "lowercase" and "lowercased".
2018-09-25 10:30:18 -04:00
Jon Dufresne
abeed587b1
Refs #27795 -- Removed force_bytes() usage in db/backends/base/schema.py.
2018-09-25 09:54:06 -04:00
Jon Dufresne
1d65ddd9c3
Refs #27795 -- Removed force_bytes() usage in db/backends/utils.py.
2018-09-25 09:53:13 -04:00
Tom Forbes
9cbdb44014
Fixed #23646 -- Added QuerySet.bulk_update() to efficiently update many models.
2018-09-18 16:14:44 -04:00
Claude Paroz
f5e347a640
Fixed #27899 -- Added support for phrase/raw searching in SearchQuery.
...
Thanks Tim Graham, Nick Pope, and Claude Paroz for contribution and review.
2018-09-17 12:03:52 -04:00
Mariusz Felisiak
da92ec7962
Fixed #29759 -- Fixed crash on Oracle when fetching a returned insert id with cx_Oracle 7.
2018-09-16 12:45:34 +02:00
Nick Pope
f87f9c5f63
Simplified introspection methods for PostgreSQL.
2018-09-14 14:34:43 -04:00
Simon Charette
a4495f4b98
Fixed #29755 -- Made migrations detect changes to Meta.default_related_name.
2018-09-14 09:09:17 -04:00
Ramiro Morales
1b1f64ee5a
Refs #14357 -- Deprecated Meta.ordering affecting GROUP BY queries.
...
Thanks Ramiro Morales for contributing to the patch.
2018-09-13 12:29:48 -04:00
Tim Graham
32fbccab40
Fixed #29749 -- Made the migrations loader ignore files starting with a tilde or underscore.
...
Regression in 29150d5da8
.
2018-09-11 12:51:11 -04:00