1
0
mirror of https://github.com/django/django.git synced 2025-03-14 03:10:45 +00:00

5581 Commits

Author SHA1 Message Date
Mariusz Felisiak
3592e9fcb1
Optimized DatabaseOperations.bulk_insert_sql() a bit on Oracle. 2024-03-11 13:24:18 +01:00
Adam Johnson
e5ec11a84d Fixed #35285 -- Optimized ForeignObject._check_unique_target(). 2024-03-11 06:52:50 +01:00
Adam Johnson
faeb92ea13 Fixed #35270 -- Optimized model's Options._property_names.
co-authored-by: Nick Pope <nick@nickpope.me.uk>
2024-03-09 16:14:18 +01:00
Giannis Terzopoulos
73df8b54a2 Fixed #35044 -- Avoided clearing reverse relations and private fields when accessing deferred fields.
Regression in a7b5ad8b19a08d7d57302ece74f6e26d2887fd9f for reverse
relations and possibly in 123b1d3fcf79f091573c40be6da7113a6ef35b62 for
private fields.
2024-03-08 11:09:54 +01:00
Giannis Terzopoulos
74f7fe3f3d Optimized Model.refresh_from_db(fields=...) by using a set. 2024-03-08 10:33:18 +01:00
Ben Cail
1570ef02f3 Fixed #35223 -- Made Model.full_clean() ignore fields with db_default when validating empty values.
Thanks Brian Ibbotson for the report.

Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.
2024-03-08 05:55:25 +01:00
Nick Pope
1669e54965
Refs #30397 -- Optimized interpolation of index and constraint names a bit more. 2024-03-08 05:49:32 +01:00
Mariusz Felisiak
1fffa4af12
Fixed typo in django/db/models/expressions.py. 2024-03-07 08:40:24 +01:00
Adam Johnson
9e35c8b2e3
Refs #30397 -- Optimized interpolation of index and constraint names a bit. 2024-03-07 05:59:13 +01:00
Michail Chatzis
4426b1a72d Fixed #35021 -- Fixed capturing queries when using client-side parameters binding with psycopg 3+. 2024-03-06 11:24:58 +01:00
Adam Johnson
ab22b7c65f
Fixed #35266 -- Deferred formatting in RelatedField._check_clashes(). 2024-03-04 20:26:23 +01:00
Sarah Boyce
fad334e1a9 Refs #33497 -- Added connection pool support for PostgreSQL.
Co-authored-by: Florian Apolloner <florian@apolloner.eu>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-03-01 09:01:18 +01:00
Simon Charette
daf7d482db Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.
Once the deprecation period ends CheckConstraint.check() can become the
documented method that performs system checks for BaseConstraint
subclasses.
2024-03-01 07:15:32 +01:00
Simon Charette
0fb104dda2 Refs #35234 -- Moved constraint system checks to Check/UniqueConstraint methods. 2024-02-29 10:38:19 +01:00
Florian Apolloner
18d79033b9 Refs #34200 -- Removed unnecessary check in DatabaseWrapper.ensure_role() on PostgreSQL.
ensure_role() is only called in init_connection_state() where a new
connection is established.
2024-02-26 10:53:47 +01:00
Adam Johnson
e65deb7d14
Fixed #35246 -- Made Field.unique a cached property.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-02-26 06:20:16 +01:00
Adam Johnson
73d5eb8084 Fixed #35241 -- Cached model's full parent list.
co-authored-by: Keryn Knight <keryn@kerynknight.com>
co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
co-authored-by: David Smith <smithdc@gmail.com>
co-authored-by: Paolo Melchiorre <paolo@melchiorre.org>
2024-02-26 05:38:31 +01:00
Florian Apolloner
50e95ad536 Simplified using DATABASES["OPTIONS"].
DATABASES["OPTIONS"] are always configured.
2024-02-23 07:49:43 +01:00
AlexCLeduc
a084c5d35a Fixed #35238 -- Fixed database serialization crash when base managers use prefetch_related().
Regression in 139135627650ed6aaaf4c755b82c3bd43f2b8f51
following deprecation in eedbf930287cb72e9afab1f7208c24b1146b0c4ec.
2024-02-20 22:14:17 +01:00
Adam Johnson
31314980be Fixed #35236 -- Used Field.attname/column attributes instead of get_attname()/get_attname_column(). 2024-02-20 11:34:00 +01:00
Adam Johnson
f65f8ab84e Refs #28011 -- Removed ForeignObjectRel.is_hidden(). 2024-02-19 12:22:46 +01:00
Albert Defler
26aae56144 Refs #34060 -- Fixed JSONField __exact lookup for primitivies on Oracle 21c+.
Regression in c991602ce5798385261381025c06698d7fd30dc5.

Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2024-02-19 08:28:42 +01:00
Adam Johnson
f25d84f61a Fixed #35232 -- Cached model's Options.verbose_name_raw. 2024-02-19 06:05:52 +01:00
Adam Johnson
5e80390add
Fixed #35230 -- Added cached ForeignObjectRel.accessor_name. 2024-02-19 05:47:12 +01:00
Aaron Linville
7a05b8a2fa Fixed #24018 -- Allowed setting pragma options on SQLite. 2024-02-16 12:59:19 +01:00
ontowhee
66e47ac69a Fixed #29725 -- Removed unnecessary join in QuerySet.count() and exists() on a many to many relation.
Co-Authored-By: Shiwei Chen <april.chen.0615@gmail.com>
2024-02-16 08:57:16 +01:00
Simon Charette
0d8fbe2ade Refs #34060 -- Fixed crash when filtering against literal JSON with psycopg2. 2024-02-16 07:40:33 +01:00
Albert Defler
c991602ce5 Fixed #34060 -- Fixed migrations crash when adding check constraints with JSONField __exact lookup on Oracle. 2024-02-15 13:57:58 +01:00
Shafiya Adzhani
22285d366c Fixed #33037 -- Fixed Trunc() with offset timezones on MySQL, SQLite, Oracle. 2024-02-15 10:02:57 +01:00
Ben Cail
8b7ddd1b62 Refs #34534 -- Reduced constraint operations with Meta.constraints when optimizing migrations. 2024-02-09 07:02:52 +01:00
bcail
9c5e382b98
Fixed #35073 -- Avoided unnecessary calling of callables used by SET/SET_DEFAULT in Collector.collect(). 2024-02-08 18:41:32 +01:00
Hisham Mahmood
d79fba7d8e Fixed #35099 -- Prevented mutating queryset when combining with & and | operators.
Thanks Alan for the report.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2024-02-07 12:36:30 +01:00
Simon Charette
e67d7d70fa Fixed #35149 -- Fixed crashes of db_default with unresolvable output field.
Field.db_default accepts either literal Python values or compilables
(as_sql) and wrap the former ones in Value internally.

While 1e38f11 added support for automatic resolving of output fields for
types such as str, int, float, and other unambigous ones it's cannot do
so for all types such as dict or even contrib.postgres and contrib.gis
primitives.

When a literal, non-compilable, value is provided it likely make the
most sense to bind its output field to the field its attached to avoid
forcing the user to provide an explicit `Value(output_field)`.

Thanks David Sanders for the report.
2024-02-04 09:39:41 +01:00
Simon Charette
fe1cb62f5c Refs #35149 -- Made equivalent db_default alterations noops.
This allows for an easier transition of preserving the literal nature of
non-compilable db_default.
2024-02-04 09:31:06 +01:00
Simon Charette
dfc77637ea Fixed #35162 -- Fixed crash when adding fields with db_default on MySQL.
MySQL doesn't allow literal DEFAULT values to be used for BLOB, TEXT,
GEOMETRY or JSON columns and requires expression to be used instead.

Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.
2024-02-03 22:47:40 +01:00
Anže Pečar
a0204ac183 Fixed #29280 -- Made the transactions behavior configurable on SQLite. 2024-01-30 11:42:34 +01:00
Nicolas Delaby
820c5f1bac Fixed #35135 -- Made FilteredRelation raise ValueError on querysets as rhs.
Regression in 59f475470494ce5b8cbff816b1e5dafcbd10a3a3.
2024-01-29 20:29:49 +01:00
Mariusz Felisiak
305757aec1
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
2024-01-26 12:45:07 +01:00
Hisham Mahmood
bbfbf0ab68
Refs #33517 -- Prevented __second lookup from returning fractional seconds on Oracle. 2024-01-23 09:09:24 +01:00
Salvo Polizzi
184d82d848
Fixed #35130 -- Doc'd django.db.close_old_connections().
This also adds close_db_connections() to the django.db.__all__.
2024-01-22 13:31:50 +01:00
Mariusz Felisiak
4879907223
Fixed #35127 -- Made Model.full_clean() ignore GeneratedFields.
Thanks Claude Paroz for the report.

Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2024-01-19 08:55:50 +01:00
Amir Karimi
27a3eee721 Fixed #31700 -- Made makemigrations command display meaningful symbols for each operation. 2024-01-17 14:00:02 +01:00
Simon Charette
0fcee1676c Fixed #35111 -- Fixed compilation of DateField __in/__range rhs on SQLite and MySQL.
Also removed tests that ensured that adapt_(date)timefield backend
operations where able to deal with expressions when it's not the case
for any other adapt methods.
2024-01-16 08:34:14 +01:00
Aivars Kalvans
f92641a636 Fixed #28344 -- Allowed customizing queryset in Model.refresh_from_db()/arefresh_from_db().
The from_queryset parameter can be used to:
- use a custom Manager
- lock the row until the end of transaction
- select additional related objects
2024-01-15 10:55:14 +01:00
Mariusz Felisiak
f3d10546a8 Refs #35102 -- Optimized replace_expressions()/relabelling aliases by adding early return.
This avoids costly hashing.

Thanks Anthony Shaw for the report.

Co-Authored-By: Simon Charette <charette.s@gmail.com>
2024-01-15 05:56:38 +01:00
Simon Charette
d074c7530b Refs #35102 -- Optimized Expression.identity used for equality and hashing.
inspect.signature() is quite slow and produces the same object for each
instance of the same class as they share their __init__ method which
makes it a prime candidate for caching.

Thanks Anthony Shaw for the report.
2024-01-15 05:56:33 +01:00
Simon Charette
92d6cff6a2 Fixed #35028 -- Disabled server-side bindings for named cursors on psycopg >= 3.
While we provide a `cursor_factory` based on the value of the
`server_side_bindings` option to `psycopg.Connection` it is ignored by
the `cursor` method when `name` is specified for `QuerySet.iterator()`
usage and it causes the usage of `psycopg.ServerCursor` which performs
server-side bindings.

Since the ORM doesn't generates SQL that is suitable for server-side
bindings when dealing with parametrized expressions a specialized cursor
must be used to allow server-side cursors to be used with client-side
bindings.

Thanks Richard Ebeling for the report.

Thanks Florian Apolloner and Daniele Varrazzo for reviews.
2024-01-12 21:40:18 +01:00
Mariusz Felisiak
8d2c16252e
Fixed #34769 -- Fixed key transforms on Oracle 21c+.
Oracle 21c introduced support for primivites in JSON fields that
caused changes in handling them by JSON_QUERY/JSON_VALUE functions.
2024-01-10 21:00:42 +01:00
Salvo Polizzi
3915d4c70d Fixed #35060 -- Deprecated passing positional arguments to Model.save()/asave(). 2024-01-02 08:42:33 +01:00
Michael
e29d1870dd
Improved variable names in QuerySet.delete(). 2024-01-02 05:30:16 +01:00