Hasan Ramezani
fe9c7ded29
Fixed #32200 -- Fixed grouping by ExpressionWrapper() with Q objects.
...
Thanks Gordon Wrigley for the report.
Regression in df32fd42b8
.
2020-11-19 21:00:04 +01:00
Seamus Quinn
9f72b0970d
Fixed #32201 -- Removed obsolete isort:skip's.
...
Obsolete as of isort 5.
2020-11-19 06:35:41 +01:00
David-Wobrock
ba42569d5c
Fixed #31507 -- Added QuerySet.exists() optimizations to compound queries.
2020-11-16 20:29:13 +01:00
Hasan Ramezani
4cce1d13cf
Fixed #32197 -- Improved error message when loading a database backend fails.
2020-11-16 06:05:03 +01:00
David-Wobrock
464a4c0c59
Fixed #31496 -- Fixed QuerySet.values()/values_list() crash on combined querysets ordered by annotations.
2020-11-14 10:22:09 +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
Hannes Ljungberg
0773837e15
Fixed #32182 -- Fixed crash of JSONField nested key transforms with subquery annotations on PostgreSQL.
2020-11-10 07:09:58 +01:00
Simon Charette
c2d4926702
Fixed #31910 -- Fixed crash of GIS aggregations over subqueries.
...
Regression was introduced by fff5186
but was due a long standing issue.
AggregateQuery was abusing Query.subquery: bool by stashing its
compiled inner query's SQL for later use in its compiler which made
select_format checks for Query.subquery wrongly assume the provide
query was a subquery.
This patch prevents that from happening by using a dedicated
inner_query attribute which is compiled at a later time by
SQLAggregateCompiler.
Moving the inner query's compilation to SQLAggregateCompiler.compile
had the side effect of addressing a long standing issue with
aggregation subquery pushdown which prevented converters from being
run. This is now fixed as the aggregation_regress adjustments
demonstrate.
Refs #25367 .
Thanks Eran Keydar for the report.
2020-11-04 09:54:58 +01:00
David-Wobrock
cfc7cd6513
Fixed #32132 -- Fixed column types in m2m intermediary tables for Positive(Big/Small)IntegerFields.
2020-11-02 20:11:58 +01:00
Simon Charette
384ac0990f
Refs #32061 -- Prevented password leak on MySQL dbshell crash.
...
The usage of the --password flag when invoking the mysql CLI has the
potential of exposing the password in plain text if the command happens
to crash due to the inclusion of args provided to
subprocess.run(check=True) in the string representation of the
subprocess.CalledProcessError exception raised on non-zero return code.
Since this has the potential of leaking the password to logging
facilities configured to capture crashes (e.g. sys.excepthook, Sentry)
it's safer to rely on the MYSQL_PWD environment variable instead even
if its usage is discouraged due to potential leak through the ps
command on old flavors of Unix.
Thanks Charlie Denton for reporting the issue to the security team.
Refs #24999 .
2020-10-30 10:12:52 +01:00
Simon Charette
bbe6fbb876
Refs #32061 -- Unified DatabaseClient.runshell() in db backends.
2020-10-29 22:22:58 +01:00
Christian Klus
4ac2d4fa42
Fixed #32152 -- Fixed grouping by subquery aliases.
...
Regression in 42c08ee465
.
Thanks Simon Charette for the review.
2020-10-29 09:56:09 +01:00
Martin Thoma
302caa40e4
Made small readability improvements.
2020-10-28 20:20:20 +01:00
Simon Charette
8593e162c9
Fixed #32143 -- Used EXISTS to exclude multi-valued relationships.
...
As mentioned in the pre-existing split_exclude() docstring EXISTS is
easier to optimize for query planers and circumvents the IN (NULL)
handling issue.
2020-10-28 07:22:00 +01:00
Simon Charette
bbf141bcdc
Refs #27149 -- Fixed sql.Query identity.
...
By making Query subclass BaseExpression in
3543129822
the former defined it's
identity based off _construct_args which is not appropriate.
2020-10-28 07:21:53 +01:00
Nguyen You
0b4fe82c74
Improved naming consistency in BaseManage.contribute_to_class().
...
Matches signatures of other contribute_to_class() methods.
2020-10-27 10:51:03 +01:00
Hannes Ljungberg
10f8b82d19
Fixed #29497 -- Fixed loss of assigned parent when saving child with bulk_create() after parent.
2020-10-26 12:00:34 +01:00
Adam Johnson
a56586eafe
Fixed #32134 -- Fixed crash of __range lookup with namedtuple.
...
Regression in 8be79984dc
.
Thanks Gordon Wrigley for the report.
2020-10-23 18:01:31 +02:00
Tim Graham
755dbf39fc
Replaced @no_oracle skips with DatabaseFeatures.allows_group_by_lob.
2020-10-22 18:16:58 +02:00
Étienne Beaulé
509d9da26f
Fixed #26390 -- Disabled grouping by Random().
...
Thanks to Tzu-ping Chung for the tests.
2020-10-21 20:54:53 +02:00
Tom Carrick
f5e07601b2
Fixed #32046 -- Added CreateCollation/RemoveCollation operations for PostgreSQL.
2020-10-21 10:53:44 +02:00
Hannes Ljungberg
0e7a45fca0
Fixed #32126 -- Fixed grouping by Case() annotation without cases.
...
Co-authored-by: Simon Charette <charettes@users.noreply.github.com>
2020-10-21 07:22:52 +02:00
Tim Graham
ede9fac758
Fixed #32120 -- Added DatabaseFeatures.indexes_foreign_keys.
2020-10-20 06:22:56 +02:00
Herbert Poul
c897b1587c
Fixed #32108 -- Made transaction.on_commit() raise TypeError when callback is not a callable.
2020-10-19 20:46:13 +02:00
Hasan Ramezani
3b1746d519
Fixed #32107 -- Fixed ProtectedError.protected_objects and RestrictedError.restricted_objects.
...
Regression in 4ca5c565f4
and
ab3cbd8b9a
.
Thanks Vitaliy Yelnik for the report.
2020-10-19 12:43:32 +02:00
Hannes Ljungberg
c7c7615d00
Fixed #32116 -- Fixed QuerySet.order_by() crash on EmptyQuerySet with union() on a single non-empty ordered queryset.
2020-10-19 08:36:07 +02:00
manav014
af87574a3c
Fixed #6517 -- Made dbshell use charset option on MySQL.
...
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-10-17 12:24:36 +02:00
Mariusz Felisiak
1fb97fb965
Refs #32096 -- Made JSONField check respect Meta.required_db_vendor.
...
Thanks Simon Charette for the implementation idea.
2020-10-15 22:05:16 +02:00
Çağıl Uluşahin
9159d173c3
Fixed #25253 -- Made AlterField operation a noop when changing attributes that don't affect the schema.
2020-10-15 20:11:07 +02:00
Mariusz Felisiak
bbd55e5863
Refs #32096 -- Fixed ExpressionWrapper crash with JSONField key transforms.
...
Regression in 6789ded0a6
.
Thanks Simon Charette and Igor Jerosimić for the report.
2020-10-14 20:56:04 +02:00
Mariusz Felisiak
7e1e198494
Refs #32096 -- Fixed __in lookup crash against key transforms for JSONField.
...
Regression in 6789ded0a6
and
1251772cb8
.
Thanks Simon Charette and Igor Jerosimić for the report.
2020-10-14 20:56:04 +02:00
David-Wobrock
ee005328c8
Fixed #31640 -- Made Trunc() truncate datetimes to Date/TimeField in a specific timezone.
2020-10-14 20:06:26 +02:00
David-Wobrock
a0571c1003
Refs #31640 -- Made Extract raise ValueError when using tzinfo with Date/TimeField.
2020-10-14 20:03:07 +02:00
Sultan
6599608c4d
Fixed #32098 -- Made FieldFile use FileField.attname.
...
After a93425a37f
FileDescriptor is a
subclass of DeferredAttribute and uses FileField.attname to access the
field data, so that custom subclasses can not only save data to files,
but also represent the same data with a different data type by
attaching FileFiled.name to a particular descriptor.
Follow up to a93425a37f
.
2020-10-12 07:22:59 +02:00
Bob Renwick
036f160733
Refs #20577 -- Deferred filtering of prefetched related querysets by reverse m2o relation.
2020-10-06 21:19:56 +02:00
Mariusz Felisiak
999cddd58d
Fixed #32073 -- Skipped collation tests on PostgreSQL < 10.
...
PostgreSQL < 10 doesn't support ICU collations.
Thanks Hannes Ljungberg for the report.
2020-10-06 12:51:35 +02:00
Simon Charette
0ef04fdd7a
Refs #31926 -- Fixed reverse related identity crash on Q() limit_choices_to.
2020-10-05 20:47:51 +02:00
Hasan Ramezani
981a3426cf
Fixed #32068 -- Added error messages on get() with filters following union(), intersection(), and difference().
2020-10-05 12:25:05 +02:00
David-Wobrock
c32d8f33d8
Fixed #31926 -- Fixed recreating queryset with FilteredRelation when using a pickled Query.
...
In a pickled join, the join_fields had the same values, but weren't the
same object (contrary to when not pickling the QuerySet).
2020-10-05 10:07:34 +02:00
Nick Pope
06c5d3fafc
Fixed #32060 -- Added Random database function.
2020-10-02 06:58:03 +02:00
David Wobrock
058747b77a
Fixed #31880 -- Made QuerySet.aggregate() raise FieldError when aggregating over aggregation aliases.
2020-09-29 09:04:25 +02: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
Hasan Ramezani
71d10ca8c9
Fixed #31723 -- Fixed window functions crash with DecimalField on SQLite.
...
Thanks Simon Charette for the initial patch.
2020-09-23 09:35:32 +02:00
Tom Carrick
e387f191f7
Fixed #31777 -- Added support for database collations to Char/TextFields.
...
Thanks Simon Charette and Mariusz Felisiak for reviews.
2020-09-21 18:24:56 +02:00
Tom Carrick
278b6187d2
Refs #21181 -- Corrected DatabaseFeatures.test_collations for Swedish collation.
...
Previously, backends used different keys "swedish-ci" or "swedish_ci".
2020-09-18 12:15:46 +02:00
Hasan Ramezani
a046bcadbe
Fixed #31916 -- Fixed combined queryset crash when combining with ordered combined querysets.
2020-09-17 08:26:06 +02:00
Kwist
981a072dd4
Fixed #31843 -- Fixed pickling named values from QuerySet.values_list().
2020-09-16 13:43:06 +02:00
Mariusz Felisiak
eaf9764d3b
Fixed #32007 -- Fixed queryset crash with Q() annotation and aggregation.
...
Thanks Gordon Wrigley for the report.
Regression in 8a6df55f2d
.
2020-09-15 11:40:59 +02:00
Tim Graham
7f2392981d
Added DatabaseIntrospection.index_default_access_method hook on the PostgreSQL backend.
...
This hook is for the CockroachDB backend where the name is 'prefix'.
2020-09-15 07:38:50 +02:00
Mariusz Felisiak
e11d05e0b4
Fixed #31990 -- Fixed QuerySet.ordered for GROUP BY queries on models with Meta.ordering.
...
Regression in 0ddb4ebf7b
.
Thanks Julien Dutriaux for the report.
2020-09-14 20:07:44 +02:00
Hasan Ramezani
5362e08624
Fixed #31943 -- Fixed recreating QuerySet.values()/values_list() when using a pickled Query.
2020-09-11 07:58:52 +02:00
Ryan Hiebert
502e75f9ed
Fixed #31750 -- Made models.Field equality compare models for inherited fields.
2020-09-09 20:52:59 +02:00
Petr Čermák
fc1446073e
Fixed #31987 -- Fixed Cast() with DurationField on MySQL.
2020-09-09 07:01:18 +02:00
Mariusz Felisiak
e6b5108acc
Fixed #27417 -- Made RenameField operation a noop for field name case changes on Oracle.
...
Field names are always uppercased in the Oracle backend. Changing case
should be a noop to avoid database errors: "ORA-00957: duplicate column
name".
2020-09-04 20:27:23 +02:00
Brian Helba
2d42e23b6d
Fixed #31941 -- Corrected FileField.deconstruct() with a callable storage.
2020-09-02 11:06:18 +02:00
Joe Jackson
9d5d865fd6
Fixed #31948 -- Added tzinfo parameter to TruncDate() and TruncTime().
2020-09-02 07:42:27 +02:00
Federico Jaramillo Martínez
179d9dc0c2
Fixed #31952 -- Fixed EmptyFieldListFilter crash with reverse relationships.
...
Thanks dacotagh for the report.
2020-08-31 09:28:05 +02:00
Simon Charette
f6405c0b8e
Fixed #31965 -- Adjusted multi-table fast-deletion on MySQL/MariaDB.
...
The optimization introduced in 7acef095d7
did not properly handle
deletion involving filters against aggregate annotations.
It initially was surfaced by a MariaDB test failure but misattributed
to an undocumented change in behavior that resulted in the systemic
generation of poorly performing database queries in 5b83bae031
.
Thanks Anton Plotkin for the report.
Refs #23576 .
2020-08-31 08:11:28 +02:00
Simon Charette
38fce49c82
Fixed #31919 -- Resolved output_field of IntegerField subclasses combinations.
2020-08-31 06:42:40 +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
Koen De Wit
4c0b4720b0
Fixed #31954 -- Fixed migration optimization for MTI model creation with parent model with mixed case app label.
2020-08-28 13:35:13 +02:00
Alexander
20d38fd759
Fixed #31947 -- Made QuerySet.update_or_create() reuse get_or_create().
2020-08-27 11:46:47 +02:00
Mariusz Felisiak
1251772cb8
Fixed #31936 -- Fixed __in lookup on key transforms for JSONField.
...
This resolves an issue on databases without a native JSONField
(MariaDB, MySQL, SQLite, Oracle), where values must be wrapped.
Thanks Sébastien Pattyn for the report.
2020-08-26 22:13:37 +02:00
Kaustubh
b9be11d442
Fixed #31918 -- Allowed QuerySet.in_bulk() to fetch on a single distinct field.
2020-08-26 09:43:39 +02:00
Tim Graham
ea880ec233
Fixed #24533 -- Dropped PostgreSQL sequence and Oracle identity when migrating away from AutoField.
2020-08-24 14:32:07 +02:00
Iuri de Silvio
632ccffc49
Fixed #31826 -- Made AlterField operation a noop when adding db_column.
...
AlterField operation with adding a db_column is a noop if the column
name is not changed.
2020-08-14 13:13:36 +02:00
Simon Charette
51297a9232
Fixed #31792 -- Made Exists() reuse QuerySet.exists() optimizations.
...
The latter is already optimized to limit the number of results, avoid
selecting unnecessary fields, and drop ordering if possible without
altering the semantic of the query.
2020-08-13 14:10:36 +02:00
Iuri de Silvio
7f4c9222df
Fixed #31825 -- Made RenameField operation a noop for fields with db_column.
2020-08-13 13:14:58 +02:00
Pat Garcia
8954f255bb
Fixed #31382 -- Made Model.save(update_fields=...) raise ValueError on non-concrete fields.
2020-08-12 21:13:55 +02:00
Gert Burger
94ea79be13
Fixed #31863 -- Prevented mutating model state by copies of model instances.
...
Regression in bfb746f983
.
2020-08-12 12:43:42 +02:00
Tom Carrick
63300f7e68
Fixed #21181 -- Added Collate database function.
...
Thanks Simon Charette for reviews.
2020-08-11 22:21:08 +02:00
Daniel Hillier
60626162f7
Fixed #31866 -- Fixed locking proxy models in QuerySet.select_for_update(of=()).
2020-08-11 11:55:10 +02:00
Iuri de Silvio
58a336a674
Fixed #31831 -- Fixed migration operations ordering when adding order_with_respect_to and constraints/indexes.
2020-08-08 20:43:45 +02:00
Jacob Walls
c7e7f176c1
Fixed #26977 -- Made abstract models raise TypeError when instantiating.
2020-08-05 06:37:04 +02:00
Alexandr Tatarinov
f4ac167119
Fixed #27719 -- Added QuerySet.alias() to allow creating reusable aliases.
...
QuerySet.alias() allows creating reusable aliases for expressions that
don't need to be selected but are used for filtering, ordering, or as
a part of complex expressions.
Thanks Simon Charette for reviews.
2020-07-31 13:19:33 +02:00
Sergey Fedoseev
0b655a4bf8
Removed unnecessary list() call in RelatedManager.add().
2020-07-30 12:19:00 +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
Tim Graham
184a6eebb0
Refs #31829 -- Added DatabaseFeatures.json_key_contains_list_matching_requires_list.
...
CockroachDB's behavior matches PostgreSQL.
2020-07-30 06:38:02 +02:00
Hasan Ramezani
9c9a3fe118
Fixed #31783 -- Fixed crash when filtering againts "negate" field.
...
Thanks Simon Charette for the initial patch.
2020-07-29 08:20:58 +02:00
sage
2d8dcba03a
Fixed #31829 -- Used JSONField __contains lookup on key transforms.
2020-07-28 13:10:12 +02:00
Mariusz Felisiak
ba691933ce
Fixed #31836 -- Dropped support for JSONField __contains and __contained_by lookups on SQLite.
...
The current implementation works only for basic examples without
supporting nested structures and doesn't follow "the general principle
that the contained object must match the containing object as to
structure and data contents, possibly after discarding some
non-matching array elements or object key/value pairs from the
containing object".
2020-07-28 13:06:52 +02:00
Mariusz Felisiak
02447fb133
Fixed #31835 -- Dropped support for JSONField __contains lookup on Oracle.
...
The current implementation works only for basic examples without
supporting nested structures and doesn't follow "the general principle
that the contained object must match the containing object as to
structure and data contents, possibly after discarding some
non-matching array elements or object key/value pairs from the
containing object".
2020-07-28 11:54:01 +02:00
Nick Pope
628c4a26ee
Refs #27996 -- Doc'd no extension required for RandomUUID() on PostgreSQL 13+.
...
https://www.postgresql.org/docs/13/functions-uuid.html
https://www.postgresql.org/docs/13/pgcrypto.html#id-1.11.7.34.10.5
2020-07-28 07:21:16 +02:00
Mariusz Felisiak
f4e93919e4
Fixed #31815 -- Fixed schema value encoding on PostgreSQL.
2020-07-27 06:39:02 +02:00
Matthias Kestenholz
c1f8d87bb0
Fixed #31812 -- Fixed FileField.model for fields defined in abstract models.
...
Regression in a93425a37f
.
2020-07-24 11:06:57 +02:00
Tom Forbes
80a8be03d9
Fixed #31765 -- Disabled bundled SQLite renaming atomic references on macOS 10.15.
2020-07-22 09:39:55 +02:00
Tim Graham
ff55adbd0d
Reverted "Fixed #30300 -- Allowed migrations to be loaded from directories without __init__.py file."
...
This reverts commit 3cd3bebe89
.
2020-07-22 07:04:06 +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
Ravindar Sharma
18d4eac7fc
Fixed #31731 -- Removed unreachable code for resetting sequences of auto-created m2m tables in sequence_reset_sql().
...
Unreachable because f.remote_field.through is truthy for all m2m
fields.
Resetting sequences of auto-created m2m tables in sequence_reset_sql()
is also unnecessary:
- in sqlsequencereset since c39ec6dccb
because auto-created tables are included in model_list,
- in loaddata because there is no it need to reset sequences for
models not loaded directly.
- in create_default_site() because it doesn't have m2m fields.
2020-07-17 08:16:32 +02:00
Mariusz Felisiak
bde33bdd51
Stopped adapting DecimalField values to strings on Oracle.
...
cx_Oracle handles decimal.Decimal.
expressions_case.tests.CaseExpressionTests.test_update_decimal fails without
this change.
Follow up to 9c5c9bd709
.
2020-07-16 09:43:08 +02:00
Simon Charette
1e38f1191d
Fixed #30446 -- Resolved Value.output_field for stdlib types.
...
This required implementing a limited form of dynamic dispatch to combine
expressions with numerical output. Refs #26355 should eventually provide
a better interface for that.
2020-07-15 10:58:29 +02:00
Simon Charette
9c5c9bd709
Stopped adapting DecimalField values to strings on PostgreSQL.
...
The psycopg2 backend uses the type information to provide type hints.
2020-07-14 07:40:10 +02:00
Simon Charette
f783a99072
Refs #25425 -- Allowed unresolved Value() instances to be compiled.
...
Previously unresolved Value() instances were only allowed to be
compiled if they weren't initialized with an output_field.
Given the usage of unresolved Value() instances is relatively common in
as_sql() overrides it's less controversial to add explicit support for
this previously undefined behavior now and revisit whether or not it
should be deprecated in the future.
2020-07-14 07:20:20 +02:00
Simon Charette
ca6c5e5fc2
Fixed #31770 -- Allowed select_for_update(of) on MySQL 8.0.1+.
2020-07-13 10:15:43 +02:00
François Freitag
04e4f80c1f
Sorted conflicting migrations by names.
2020-07-10 12:18:42 +02:00
matt ferrante
7d6916e827
Fixed #29789 -- Added support for nested relations to FilteredRelation.
2020-07-09 20:24:00 +02:00
Mariusz Felisiak
8a6df55f2d
Fixed #31773 -- Fixed preserving output_field in ExpressionWrapper for combined expressions.
...
Thanks Thodoris Sotiropoulos for the report and Simon Charette for the
implementation idea.
Regression in df32fd42b8
.
2020-07-09 11:55:03 +02:00
davidchorpash
779e615e36
Fixed #31573 -- Made QuerySet.update() respect ordering on MariaDB/MySQL.
2020-07-08 11:43:50 +02:00
Mariusz Felisiak
ae8338daf3
Fixed #31767 -- Fixed QuerySet.none() on combined queryset.
2020-07-07 12:15:05 +02:00
Jacob Walls
512da9d585
Fixed #23797 -- Fixed QuerySet.exclude() when rhs is a nullable column.
2020-07-06 10:15:37 +02:00
Hasan Ramezani
b7b7df5fbc
Fixed #31530 -- Added system checks for invalid model field names in CheckConstraint.check and UniqueConstraint.condition.
2020-07-06 09:16:57 +02:00
Sergey Fedoseev
4ce7d86cbe
Removed duplicated sqlite3 converter.
...
Converters typenames are case-insensitive. See
https://docs.python.org/3/library/sqlite3.html#sqlite3.register_converter .
2020-07-03 09:55:59 +02:00
Sergey Fedoseev
37389ae99e
Fixed #31758 -- Removed unneeded BytesToCharFieldConversionMixin.
...
Bug was fixed in mysqlclient 1.3.13.
2020-07-02 21:26:01 +02:00
Sergey Fedoseev
9d519d3dc4
Fixed #31755 -- Made temporal subtraction resolve output field.
2020-07-01 23:02:27 +02:00
Sergey Fedoseev
ed6b14d459
Refs #28621 -- Fixed crash of annotations with nested OuterRef.
2020-07-01 11:01:46 +02:00
Mariusz Felisiak
615e32162f
Fixed #31751 -- Fixed database introspection with cx_Oracle 8.
2020-06-30 09:50:15 +02:00
alosultan
a93425a37f
Fixed #31701 -- Made FileDescriptor subclass DeferredAttribute.
2020-06-30 08:25:20 +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
Sergey Fedoseev
9d752dabe3
Refs #28925 -- Simplified CombinedExpression.as_sql() a bit.
2020-06-30 07:02:21 +02:00
Hannes Ljungberg
30e3d2d78d
Fixed #31745 -- Added error messages when using UniqueConstraint.include/opclasses with deferrable.
2020-06-29 06:41:23 +02:00
Mariusz Felisiak
62d85a2835
Fixed #31742 -- Fixed makemigrations crash on ForeignKey to an app with mixed case label.
...
Regression in 9e1b6b8a66
.
Thanks Ignacio Santolin for the report.
2020-06-26 23:18:59 +02:00
Jon Dufresne
e13cfc6dfd
Fixed #31596 -- Changed ForeignKey.validate() to use the base manager.
2020-06-25 11:36:20 +02:00
Nick Pope
074844e947
Fixed #31529 -- Added support for serialization of pathlib.Path/PurePath and os.PathLike in migrations.
2020-06-24 11:45:34 +02:00
Simon Charette
2e8941b6f9
Fixed #31735 -- Fixed migrations crash on namespaced inline FK addition on PostgreSQL.
...
The namespace of the constraint must be included when making the
constraint immediate.
Regression in 22ce5d0031
.
Thanks Rodrigo Estevao for the report.
2020-06-24 08:37:20 +02:00
Jon Dufresne
6f3e3e87ab
Fixed #31703 -- Made makemigrations name all initial migrations "initial".
...
When the MigrationAutodetector creates more than one initial migration
in a app, name all initial migrations "initial" rather than the opaque
"auto_<DATE>_<TIME>" name.
Initial migrations that have a descriptive name continue to use the
descriptive name.
2020-06-24 07:18:45 +02:00
Jon Dufresne
bce180dd05
Refs #31703 -- Moved MigrationAutodetector.suggest_name() to Migration.
...
Allows expanding the method to inspect additional attributes of the
migration instance. For example, the Migration.initial attribute.
2020-06-24 07:01:11 +02:00
Adam Johnson
e37f809618
Combined MySQL backend server info queries.
2020-06-22 09:58:46 +02:00
Mariusz Felisiak
82da72b748
Refs #28077 -- Added opclasses to Index.__repr__().
...
This also removes unnecessary commas between attributes.
2020-06-17 10:32:43 +02:00
Simon Charette
ea3beb4f5a
Refs #30446 -- Defined default output_field of text database functions.
...
This prevented the default behavior of
BaseExpression._resolve_output_field from error'ing out when such
functions accepted both expressions from mixed types
(e.g. SubStr(CharField, IntegerField, IntegerField)).
2020-06-16 10:08:02 +02:00
Hannes Ljungberg
7edc6e53a7
Fixed #31702 -- Added support for PostgreSQL opclasses in UniqueConstraint.
2020-06-16 07:19:00 +02:00
Sultan
6b25d24a57
Fixed #31706 -- Removed unnecessary getattr() call in FileDescriptor.__get__().
...
refresh_from_db() loads fields values.
2020-06-15 07:26:49 +02:00
Hasan Ramezani
9e8edc1e55
Fixed #31491 -- Allowed 'password' option in DATABASES['OPTIONS'] on MySQL.
2020-06-12 12:07:43 +02:00
Mariusz Felisiak
aeb8996a67
Fixed #31659 -- Made ExpressionWrapper preserve output_field for combined expressions.
...
Regression in df32fd42b8
.
Thanks Simon Charette for the review.
2020-06-12 07:20:06 +02:00
Adam Johnson
5776a1660e
Fixed #31667 -- Made __in lookup ignore None values.
2020-06-11 12:12:26 +02:00
alosultan
678c8dfee4
Fixed #31680 -- Removed unnecessary getattr() call in DeferredAttribute.__get__().
...
refresh_from_db() loads fields values.
2020-06-10 12:24:18 +02:00
SergBobrovsky
9bfa6a35f0
Removed unnecessary list() call in ModelBase.__new__().
...
Unnecessary since 58ad030d05
.
2020-06-10 12:10:36 +02:00
Hasan Ramezani
037a624120
Fixed #31657 -- Fixed ordering by attnames of self-referential ForeignKeys.
2020-06-10 11:14:26 +02:00
Nicolas Baccelli
b38d44229f
Fixed #31664 -- Reallowed using non-expressions having filterable attribute as rhs in queryset filters.
...
Regression in 4edad1ddf6
.
2020-06-08 08:17:23 +02:00
Mariusz Felisiak
78ad4b4b02
Fixed #31660 -- Fixed queryset crash when grouping by m2o relation.
...
Regression in 3a941230c8
.
Thanks Tomasz Szymański for the report.
2020-06-08 07:21:54 +02:00
Sasha Pachev
38a21f2d9e
Fixed #31663 -- Made DecimalField.to_python() handle non-numeric invalid values.
2020-06-05 21:13:36 +02:00
Mariusz Felisiak
f83b44075d
Refs #30913 -- Added system checks for covering indexes and unique constraints support.
2020-06-04 12:26:25 +02:00
Hannes Ljungberg
8c7992f658
Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+.
2020-06-04 12:26:22 +02:00
Tim Graham
a7b4a04d6c
Refs #31630 -- Added CharField and IntegerField to DatabaseFeatures.introspected_field_types.
...
CockroachDB introspects CharField as TextField and IntegerField as
BigIntegerField.
2020-06-04 08:46:06 +02:00
Tim Graham
e24b63fe85
Refs #31630 -- Removed DatabaseFeatures.can_introspect_autofield.
2020-06-04 08:27:46 +02:00
Hasan Ramezani
e198beadad
Fixed #31630 -- Replaced introspection features with DatabaseFeatures.introspected_field_types.
2020-06-04 08:27:42 +02:00
Thodoris Sotiropoulos
df32fd42b8
Fixed #31651 -- Made ExpressionWrapper use grouping columns from wrapped expression.
2020-06-03 07:29:41 +02:00
Simon Charette
f8ef5f2c86
Refs #21171 -- Made Collector.delete() rollback in the correct database.
...
Regression in c7dd8490b882b2cefdc7faf431dc64c532b79c9.
2020-05-29 10:24:37 +02:00
Adam Johnson
fa58450a9a
Fixed #31468 -- Allowed specifying migration filename in Operation.
...
This adds also suggested filename for many built-in operations.
2020-05-28 11:42:53 +02:00
Ryan Heard
587b179d41
Fixed #31606 -- Allowed using condition with lookups in When() expression.
2020-05-27 07:32:23 +02:00
Laurent Tramoy
2aac176e86
Fixed #31614 -- Fixed aliases ordering by OrderBy() expressions of combined queryset.
2020-05-26 21:14:45 +02:00
Nan Liu
33c365781a
Fixed #31416 -- Made autodetector find dependencies for MTI model creation on base fields removal.
...
Removing a base field must take place before adding a new inherited
model that has a field with the same name.
2020-05-26 07:26:07 +02:00
Simon Charette
972000420e
Fixed #31624 -- Avoided subquery usage on QuerySet.all().delete().
...
Thanks Adam Johnson for the report.
Regression in 7acef095d7
.
2020-05-25 08:14:49 +02:00
Manuel Weitzman
a4e6030904
Fixed #30375 -- Added FOR NO KEY UPDATE support to QuerySet.select_for_update() on PostgreSQL.
2020-05-21 10:51:10 +02:00
Hasan Ramezani
3c7bf39e23
Fixed #31410 -- Added system checks for invalid model field names in UniqueConstraint.
2020-05-20 10:56:55 +02:00
Mariusz Felisiak
a125da6a7c
Fixed #31607 -- Fixed evaluated Subquery equality.
...
Regression in 691def10a0
.
2020-05-19 22:44:57 +02:00
Mariusz Felisiak
20a8a443f0
Fixed #31578 -- Dropped support for MySQL 5.6.
2020-05-19 10:56:39 +02:00
Tim Graham
f59a2b7306
Refs #12990 -- Added DatabaseFeatures.has_json_operators.
...
CockroachDB also has them.
2020-05-18 08:12:20 +02:00
Mariusz Felisiak
3a941230c8
Fixed #31584 -- Fixed crash when chaining values()/values_list() after Exists() annotation and aggregation on Oracle.
...
Oracle requires the EXISTS expression to be wrapped in a CASE WHEN in
the GROUP BY clause.
Regression in efa1908f66
.
2020-05-14 15:07:08 +02:00
Simon Charette
adfbf653dc
Fixed #31568 -- Fixed alias reference when aggregating over multiple subqueries.
...
691def10a0
made all Subquery() instances
equal to each other which broke aggregation subquery pushdown which
relied on object equality to determine which alias it should select.
Subquery.__eq__() will be fixed in an another commit but
Query.rewrite_cols() should haved used object identity from the start.
Refs #30727 , #30188 .
Thanks Makina Corpus for the report.
2020-05-14 09:31:15 +02:00
Simon Charette
42c08ee465
Fixed #31566 -- Fixed aliases crash when chaining values()/values_list() after annotate() with aggregations and subqueries.
...
Subquery annotation references must be resolved if they are excluded
from the GROUP BY clause by a following .values() call.
Regression in fb3f034f1c
.
Thanks Makina Corpus for the report.
2020-05-14 08:16:16 +02:00
Mariusz Felisiak
e536fa5ce1
Fixed #31579 -- Dropped support for PostgreSQL 9.5 and PostGIS 2.2.
2020-05-14 06:33:00 +02:00
Hasan Ramezani
01a381cc17
Fixed #31580 -- Added error messages on distinct() following union(), intersection(), and difference().
2020-05-13 14:44:10 +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
Adam Johnson
a8b2db1cae
Optimized Model and QuerySet pickling version comparison.
2020-05-11 09:50:11 +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
Mariusz Felisiak
f97f71f592
Refs #12990 -- Bumped mysqlclient requirement to >= 1.4.0.
...
MySQLdb.constants.FIELD_TYPE.JSON was added in mysqlclient 1.4.0rc2.
2020-05-08 06:14:42 +02:00
Adam Johnson
1c2c6f1b51
Fixed a/an typos in "SQL" usage.
2020-05-06 06:35:26 +02:00
Mariusz Felisiak
b73e66e758
Fixed #31538 -- Fixed Meta.ordering validation lookups that are not transforms.
...
Regression in 440505cb2c
.
Thanks Simon Meers for the report.
2020-05-05 09:08:29 +02:00
Adam Johnson
d17b380653
Refs #30573 -- Rephrased "Of Course" and "Obvious(ly)" in documentation and comments.
2020-05-04 12:10:47 +02:00
Ian Foote
c226c6cb32
Fixed #20581 -- Added support for deferrable unique constraints.
2020-04-30 10:43:50 +02:00
François Freitag
abea86f9e4
Removed unnecessary tuple wrapping of single format string argument.
2020-04-27 08:30:16 +02:00
Tim Schilling
a92cc84b4a
Refs #31369 -- Deprecated models.NullBooleanField in favor of BooleanField(null=True).
2020-04-24 10:10:45 +02:00
Hannes Ljungberg
104493311e
Refs #30913 -- Added BaseDatabaseSchemaEditor._index_condition_sql().
2020-04-24 07:10:26 +02:00
David Wobrock
533b208775
Fixed #29224 -- Fixed removing index_together indexes if exists unique_together constraint on the same fields.
2020-04-23 12:28:51 +02:00
Hannes Ljungberg
447980e72a
Fixed #31500 -- Fixed detecting of unique fields in QuerySet.in_bulk() when using Meta.constraints.
...
Detection of unique fields now takes into account non-partial unique
constraints.
2020-04-23 08:07:08 +02:00
Adam Johnson
67f9d076cf
Avoided unnecessary recompilation of ordering clause regex in SQLCompiler.
2020-04-22 20:28:01 +02:00
Simon Charette
06889d6206
Fixed #31499 -- Stored ModelState.fields into a dict.
...
This allows the removal of its O(n) .get_field_by_name method and many
other awkward access patterns.
While fields were initially stored in a list to preserve the initial
model definiton field ordering the auto-detector doesn't take field
ordering into account and no operations exists to reorder fields of a
model.
This makes the preservation of the field ordering completely superflous
because field reorganization after the creation of the model state
wouldn't be taken into account.
2020-04-22 07:10:00 +02:00
Simon Charette
696024fb73
Refs #31499 -- Ignored field ordering to determine ModelState equality.
2020-04-22 06:20:54 +02:00
Jon Dufresne
75866b93cc
Fixed #31479 -- Added support to reset sequences on SQLite.
2020-04-21 10:41:47 +02:00
Simon Charette
5220ca8d8a
Refs #30591 -- Adjusted table rebuild for non-pk relationship on SQLite.
...
The existing code was only accounting for primary key changes and not
all unique key fields that can be referenced.
2020-04-21 08:37:47 +02:00
Simon Charette
a548280857
Fixed #31064 -- Recreated auto-created many-to-many tables on primary key data type change on SQLite.
...
Both local and remote auto-created many-to-many relationships were
affected.
2020-04-21 08:37:40 +02:00
Simon Charette
330c0ed7c4
Stopped rebuilding referenced tables multiple times on SQLite alterations.
2020-04-20 13:13:57 +02:00
Jon Dufresne
505fec6bad
Capitalized Unicode in docs, strings, and comments.
2020-04-20 12:10:33 +02:00
Hasan Ramezani
35a67b3731
Fixed #31474 -- Made QuerySet.delete() not return the number of deleted objects if it's zero.
2020-04-20 09:51:54 +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
661e39c8d5
Fixed #24559 -- Made MigrationLoader.load_disk() catch more specific ModuleNotFoundError.
...
Avoids inspecting the exception message, which is not considered a
stable API and can change across Python versions.
ModuleNotFoundError was introduced in Python 3.6. It is a subclass of
ImportError that is raised when the imported module does not exist. It
is not raised for other errors that can occur during an import. This
exception instance has the property "name" which holds the name of
module that failed to import.
2020-04-20 07:22:20 +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
8005829bb9
Simplified DatabaseOperations.sql_flush() on Oracle and PostgreSQL.
...
Added early return to decrease an indentation level.
2020-04-17 10:46:19 +02:00
Mariusz Felisiak
eeab63e57e
Refs #26552 -- Made reloading the database for tests check only loaded tables constraints.
2020-04-17 08:14:27 +02:00
sobolevn
578c03b276
Fixed #31223 -- Added __class_getitem__() to Manager and QuerySet.
2020-04-15 11:26:11 +02:00
Adam Johnson
5b884d45ac
Fixed #29501 -- Allowed dbshell to pass options to underlying tool.
2020-04-14 14:02:51 +01:00
Ichlasul Affan
53d229ff63
Fixed #31351 -- Added system checks for partial indexes and unique constraints support.
2020-04-10 12:00:27 +02:00
Simon Charette
f5ede1cb6d
Refs #28305 -- Consolidated field referencing detection in migrations.
...
This moves all the field referencing resolution methods to shared
functions instead of duplicating efforts amongst state_forwards and
references methods.
2020-04-10 09:19:16 +02:00
Mariusz Felisiak
9cab261427
Refs #31411 -- Used RENAME COLUMN on MySQL 8.0.4+.
...
MySQL 8.0.3 added support for this syntax but also imposed a
restriction against ALTER TABLE RENAME on tables in a foreign key
relationship if a LOCK TABLES was active which has been lifted in MySQL
8.0.4+.
2020-04-09 11:16:28 +02:00
Simon Charette
8b7b19f6c9
Replaced ModelTuple by a model resolving function and bare tuples.
...
ModelTuple made handling of app_label=None easier but it isn't necessary
anymore.
2020-04-09 10:08:06 +02:00
Simon Charette
5ca5178a78
Replaced Operation._get_model_tuple() by ModelTuple.from_model().
...
This method predated the introduction of ModelTuple and had a single use.
2020-04-09 10:08:06 +02:00
Simon Charette
8069526ce3
Made Operation.references_model/references_field require app_label.
...
This will allow them to drop a ton of logic to deal with null
app_label.
2020-04-09 10:08:06 +02:00
Simon Charette
25bf15c0da
Refs #22608 -- Made app_label required when optimizing migrations.
...
This paved the way for the removal of lot of logic when app_label was
not specified.
2020-04-09 10:08:02 +02:00
miigotu
210657b791
Fixed #28184 -- Allowed using a callable for FileField and ImageField storage.
2020-04-08 11:26:17 +02:00
Simon Charette
ad811335bd
Refs #29000 -- Restored delayed model rendering of RenameField.
...
Non-delayed rendering is unnecessary and wasteful now that state models
relationship consistency on delayed reload is ensured.
This partly reverts commit fcc4e251db
.
2020-04-07 09:20:46 +02:00
Simon Charette
1d16c5d562
Refs #27666 -- Ensured relationship consistency on delayed reloads.
...
Delayed reloads of state models broke identity based relationships
between direct and non-direct ancestors.
Basing models.Options related objects map of model labels instead of
their identity ensured relationship consistency is maintained.
Refs #30966 .
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2020-04-07 09:20:46 +02:00
Sergey Fedoseev
026719cf17
Fixed #31030 -- Registered SQLite functions as deterministic on Python 3.8+.
2020-04-06 11:26:00 +02:00
Simon Charette
513948735b
Fixed #31426 -- Added proper field validation to QuerySet.order_by().
...
Resolve the field reference instead of using fragile regex based string
reference validation.
2020-04-06 10:19:49 +02:00
Simon Charette
98ea4f0f46
Refs #7098 -- Deprecated passing raw column aliases to order_by().
...
Now that order_by() has expression support passing RawSQL() can achieve
the same result.
This was also already supported through QuerySet.extra(order_by) for
years but this API is more or less deprecated at this point.
2020-04-06 10:01:02 +02:00
Hasan Ramezani
4237050684
Fixed #31420 -- Fixed crash when filtering subquery annotation against a SimpleLazyObject.
...
Thanks Simon Charette for the solution and analysis.
2020-04-06 07:11:29 +02:00
Hasan Ramezani
6fbce45b03
Fixed #31415 -- Fixed crash when nested OuterRef is used with operators or in database functions.
2020-04-04 20:16:00 +02:00
c-bata
89032876f4
Fixed #31275 -- Optimized sql_flush() without resetting sequences on MySQL.
...
Co-Authored-By: Simon Charette <charettes@users.noreply.github.com>
2020-04-02 12:57:53 +02:00
Matthijs Kooijman
75520e1767
Refs #31051 -- Optimized serialize_db_to_string() by avoiding creation of models list.
2020-04-02 11:38:23 +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
Hasan Ramezani
1fe3e24264
Fixed #31411 -- Used RENAME COLUMN on MariaDB 10.5.2+.
2020-04-02 06:56:15 +02:00
Mariusz Felisiak
5c24c16e68
Refs #12990 -- Moved PostgresSimpleLookup to the django.db.models.lookups.PostgresOperatorLookup.
2020-04-01 10:55:53 +02:00
Adam Johnson
93ed71e058
Fixed #31403 -- Added support for returning fields from INSERT statements on MariaDB 10.5+.
2020-03-31 07:25:50 +02:00
Adam Johnson
c06d7c9239
Refs #31403 -- Made SQLInsertCompiler.execute_sql() always return an iterable of rows.
...
List of tuples.
2020-03-31 07:12:11 +02:00
Tim Graham
8bebb8f126
Fixed #31399 -- Made SchemaEditor._alter_field() ignore foreign key constraints if unsupported.
2020-03-25 20:13:29 +01:00
Adam Johnson
9e1b6b8a66
Fixed #23916 -- Allowed makemigrations to handle related model name case changes.
...
Made autodetector ignore related model name case changes so unnecessary
migrations are not created.
2020-03-25 10:39:34 +01:00
Hannes Ljungberg
f3da09df0f
Fixed #31396 -- Added binary XOR operator to F expressions.
2020-03-25 10:16:30 +01:00
Hasan Ramezani
10866a10fe
Fixed #31377 -- Disabled grouping by aliases on QuerySet.values()/values_list() when they collide with field names.
...
Regression in fb3f034f1c
.
Thanks Holovashchenko Vadym for the report.
2020-03-25 09:13:46 +01:00
Shipeng Feng
8fe2447a01
Fixed #31392 -- Avoided unnecessary SchemaEditor.effective_default() calls when altering a field.
2020-03-24 13:09:43 +01:00
Hasan Ramezani
53b6a466d8
Refs #29724 -- Added is_dst parameter to QuerySet.datetimes().
...
Thanks Simon Charette for the review and Mariusz Felisiak for tests.
2020-03-20 12:55:33 +01:00
Rohit
2695ac8e04
Fixed #31144 -- Relaxed system check for max_length of CharFields on MySQL/MariaDB by turning into a warning.
2020-03-20 12:28:10 +01:00
Jon Dufresne
013147fae2
Fixed #31285 -- Fixed inherited Meta.ordering of "-pk".
2020-03-19 12:57:07 +01:00
Mariusz Felisiak
6e026aec5f
Refs #29548 -- Mentioned MariaDB in database system checks.
2020-03-19 09:42:04 +01:00
Mariusz Felisiak
5c8441a0b8
Refs #31055 -- Made long column names checks support databases aware.
2020-03-18 18:41:40 +01:00
Simon Charette
9f07f27124
Fixed #31376 -- Optimized nulls ordering when possible on SQLite and MySQL.
...
Both backends order NULLs first on ascending ordering and last on
descending ordering which makes ORDER BY IS (NOT)? NULL wasteful when
asc(nulls_first) and desc(nulls_last) are used since it prevents indice
usage.
2020-03-18 06:43:49 +01:00
Claude Paroz
e663f695fb
Fixed #31359 -- Deprecated get_random_string() calls without an explicit length.
2020-03-11 13:16:44 +01:00
David Wobrock
d88365708c
Fixed #31318 -- Allowed sqlmigrate to inspect squashed migrations.
2020-03-09 08:42:30 +01:00
David Wobrock
71c1b7fb34
Refs #31318 -- Moved MigrationExecutor.collect_sql() to MigrationLoader.
...
collect_sql() is used only in sqlmigrate.
2020-03-09 08:23:56 +01:00
shankarj67
df4d622cac
Fixed #31345 -- Added BaseDatabaseIntrospection.get_relations().
2020-03-06 08:53:32 +01:00
Abhijeet Viswa
babd412685
Fixed #29129 -- Skipped UPDATE when adding a model instance with inherited primary key that has a default.
2020-03-05 12:08:38 +01:00
Jon Dufresne
769cee5252
Fixed #31327 -- Deprecated providing_args argument for Signal.
2020-03-05 09:38:52 +01:00
aryan
427a7e419b
Fixed #31333 -- Added BaseDatabaseIntrospection.get_table_description().
2020-03-04 12:26:31 +01:00
Mariusz Felisiak
a19505eb2e
Refs #31331 -- Added DatabaseWrapper.sql_mode to MySQL.
2020-03-03 11:25:37 +01:00
Mariusz Felisiak
7b8fa1653f
Fixed #31150 -- Included subqueries that reference related fields in GROUP BY clauses.
...
Thanks Johannes Hoppe for the report.
Regression in fb3f034f1c
.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2020-03-03 11:25:37 +01:00
Simon Charette
daaa894960
Refs #26064 -- Avoided unnecessary list slicing in migration optimizer.
...
The in_between list is only necessary if an optimization is possible.
2020-03-02 08:42:06 +01:00
Hans Aarne Liblik
a21f7b91db
Fixed #31301 -- Fixed crash of QuerySet.bulk_create() with mixed empty and set ForeignKeys to AutoFields on Oracle.
2020-02-28 12:56:03 +01:00
Matheus Cunha Motta
e908eb6287
Fixed #31310 -- Fixed hints in checks for using intermediate model with ambiguous foreign key.
...
symmetrical=False is not required since
87b1ad6e73
.
2020-02-28 08:38:57 +01:00
Rohit
486786c4c4
Fixed #31251 -- Disabled grouping by OuterRef() annotation.
2020-02-27 13:02:49 +01:00
Valze
5bf28ac2ed
Fixed #31185 -- Fixed detecting of unique fields in ForeignKey/ForeignObject checks when using Meta.constraints.
2020-02-27 10:53:29 +01:00
Simon Charette
41ebe60728
Fixed #31312 -- Properly ordered temporal subtraction params on MySQL.
...
Regression in 9bcbcd599a
.
Thanks rick2ricks for the report.
2020-02-27 08:50:55 +01:00
Taoup
271fdab8b7
Fixed #31286 -- Made database specific fields checks databases aware.
...
Follow up to 0b83c8cc4d
.
2020-02-24 14:23:46 +01:00
Mariusz Felisiak
d270c10a72
Refs #31187 -- Added total_unique_constraints property to model's Options.
2020-02-19 09:36:19 +01:00
Carlton Gibson
a34cb5a6d4
Refs #31282 -- Clarified M2O add/remove/set with PK behaviour.
...
Improved error message for remove() and added tests.
2020-02-18 19:54:29 +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
Xavier Francisco
8690878507
Fixed #31277 -- Relaxed system check of m2m intermediary tables for db_table collision when database routers are installed.
...
Turned the error into a warning when database routers are installed.
2020-02-17 13:53:45 +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
Abhijeet Viswa
1712a76b9d
Fixed #31246 -- Fixed locking models in QuerySet.select_for_update(of=()) for related fields and parent link fields with multi-table inheritance.
...
Partly regression in 0107e3d105
.
2020-02-11 20:43:57 +01:00
Simon Charette
71756bdfed
Fixed #31055 -- Made constraint checks support databases aware.
2020-02-07 11:03:53 +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
Hasan Ramezani
da79ee472d
Fixed #26813 -- Prevented empty choice in ModelChoiceField with RadioSelect for fields with blank=False.
2020-02-05 10:27:01 +01:00
Nick Pope
335c9c94ac
Simplified imports from django.db and django.contrib.gis.db.
2020-02-04 13:20:06 +01:00
Mariusz Felisiak
6b178a3e93
Fixed #31217 -- Made QuerySet.values()/values_list() group by not selected annotations with aggregations used in order_by().
...
Regression in 59b4e99dd0
.
Thanks Jon Dufresne for the report and Simon Charette for the review.
2020-02-03 07:48:11 +01:00
Adam Johnson
c1b24718e0
Cached ForeignObject.(local/foreign/reverse)_related_fields properties.
2020-01-31 14:07:52 +01:00
Hasan Ramezani
a97111eabf
Fixed 31207 -- Prevented references to non-local remote fields in ForeignKey.to_field.
...
Thanks Simon Charette for the initial patch and review.
2020-01-31 10:19:12 +01:00
Matthias Kestenholz
4e8d89020c
Fixed #31219 -- Fixed object deletion crash for nested protected related objects.
2020-01-31 09:07:58 +01:00
Taoup
efc1c73bf5
Simplified DeferredAttribute.__get__() a bit.
2020-01-29 16:06:56 +01:00
Mariusz Felisiak
b7a3a6c9ef
Used model's Options.label/label_lower where applicable.
2020-01-29 12:09:20 +01:00
Hasan Ramezani
4ca5c565f4
Refs #27852 -- Fixed object deletion to show all restricted related objects rather than just the first one.
2020-01-29 09:02:23 +01:00
Mariusz Felisiak
2a6fc89018
Refs #27852 -- Renamed a loop variable in Collector.collect() to avoid redefinition.
2020-01-29 09:02:23 +01:00