1
0
mirror of https://github.com/django/django.git synced 2025-03-27 17:50:46 +00:00

5303 Commits

Author SHA1 Message Date
Florian Apolloner
1d90c9b113 Refs #33308 -- Added psycopg_any.IsolationLevel. 2022-12-12 10:36:42 +01:00
Florian Apolloner
2f38f7b8f9 Refs #33308 -- Added psycopg_any.sql.quote() hook. 2022-12-12 10:35:38 +01:00
Florian Apolloner
2ebfbd894e Refs #33308 -- Moved psycopg2 imports to the psycopg_any module. 2022-12-12 08:36:17 +01:00
Mariusz Felisiak
cbc0fb3705
Made inspectdb used Cursor.description.display_size for CharFields' max_length.
internal_size is size for fixed-size types not for char types.
2022-12-08 09:00:35 +01:00
Mariusz Felisiak
95a101a690
Fixed #34201 -- Bumped minimum supported SQLite to 3.21.0. 2022-12-08 05:53:18 +01:00
Florian Apolloner
6a21658163 Refs #33308 -- Modernized database wrapper in the PostgreSQL backend.
- Used connection.info instead of connection.get_parameter_status() and
  connection.server_info which don't exist in psycopg 3.
- Set encoding using the client_encoding connection parameter instead
  of connection.set_client_encoding() that doesn't exist in psycopg 3.
- Used the dbname connection parameter instead of deprecated
  alias - database.
2022-12-06 12:48:16 +01:00
Mariusz Felisiak
3d3e955efa
Removed redundant definition of DatabaseFeatures.can_release_savepoints on MySQL. 2022-12-05 12:08:21 +01:00
Simon Charette
0ff46591ac Refs #33308 -- Deprecated support for passing encoded JSON string literals to JSONField & co.
JSON should be provided as literal Python objects an not in their
encoded string literal forms.
2022-12-01 19:14:00 +01:00
Florian Apolloner
3cafb783f3 Refs #33308 -- Used psycopg's errors instead of errorcodes. 2022-12-01 09:17:33 +01:00
Simon Charette
0db8bf3d60 Refs #10929 -- Fixed aggregates crash when passing strings as defaults.
Previously strings were interpreted as F() expressions and default
crashed with AttributeError:
    'F' object has no attribute 'empty_result_set_value'
2022-11-29 13:08:05 +01:00
Mariusz Felisiak
20d575b101
Refs #31169 -- Skipped test_get_test_db_clone_settings_not_supported on not in-memory SQLite database.
multiprocessing's start method is checked only for in-memory SQLite
databases.
2022-11-28 09:30:22 +01:00
David Sanders
64b3c413da Fixed #34103 -- Fixed logging SQL queries with duplicate parameters on Oracle. 2022-11-25 09:42:25 +01:00
Christophe Baldy
70c945d6b3
Used DatabaseFeatures.django_test_skips to skip AssertNumQueriesUponConnectionTests tests. 2022-11-24 19:41:08 +01:00
baldychristophe
855f5a36e7 Fixed #29062 -- Prevented possibility of database lock when using LiveServerTestCase with in-memory SQLite database.
Thanks Chris Jerdonek for the implementation idea.
2022-11-24 10:52:48 +01:00
Simon Charette
1297c0d0d7 Fixed #31679 -- Delayed annotating aggregations.
By avoiding to annotate aggregations meant to be possibly pushed to an
outer query until their references are resolved it is possible to
aggregate over a query with the same alias.

Even if #34176 is a convoluted case to support, this refactor seems
worth it given the reduction in complexity it brings with regards to
annotation removal when performing a subquery pushdown.
2022-11-23 17:46:07 +01:00
DevilsAutumn
4035bab56f Fixed #34171 -- Fixed QuerySet.bulk_create() on fields with db_column in unique_fields/update_fields.
Bug in 0f6946495a8ec955b471ca1baaf408ceb53d4796.

Thanks Joshua Brooks for the report.
2022-11-22 14:47:21 +01:00
Mariusz Felisiak
7d5329852f
Fixed #34177 -- Fixed QuerySet.bulk_create() crash on "pk" in unique_fields.
Bug in 0f6946495a8ec955b471ca1baaf408ceb53d4796.
2022-11-22 14:26:23 +01:00
Ilya Bass
798e38c2b9 Fixed #31090 -- Logged transaction management queries.
Thanks to Petter Strandmark for the original idea and Mariusz Felisiak
for advice during the DjangoConUS 2022 Sprint!
2022-11-21 09:10:14 +01:00
Mariusz Felisiak
c0a93d3941
Removed unnecessary ForeignKey.get_reverse_path_info().
get_reverse_path_info() is already inherited from ForeignObject.
2022-11-18 14:47:29 +01:00
DevilsAutumn
81b1c167bf Fixed #28987 -- Fixed altering ManyToManyField when changing to self-referential. 2022-11-17 12:36:52 +01:00
Simon Charette
5c23d9f0c3 Refs #33308 -- Used get_db_prep_value() to adapt JSONFields. 2022-11-15 13:02:36 +01:00
Simon Charette
d87a7b9f4b Refs #33308 -- Stopped inheriting from FieldGetDbPrepValueMixin by PostgresOperatorLookup. 2022-11-15 13:02:36 +01:00
Simon Charette
70499b25c7 Fixed #34123 -- Fixed combinator order by alias when using select_related().
Regression in c58a8acd413ccc992dd30afd98ed900897e1f719.

Thanks to Shai Berger for the report and tests.

Co-Authored-By: David Sanders <shang.xiao.sanders@gmail.com>
2022-11-15 10:48:19 +01:00
Simon Charette
7adb0c8b60 Avoided unnecessary usage of RawSQL.
This ensures proper alias quoting.
2022-11-15 10:48:14 +01:00
Simon Charette
b181cae2e3 Refs #25307 -- Replaced SQLQuery.rewrite_cols() by replace_expressions().
The latter offers a more generic interface that doesn't require
specialized expression types handling.
2022-11-14 09:05:32 +01:00
Simon Charette
1771998c09 Reduced nesting inside Query.get_aggregation(). 2022-11-14 09:01:21 +01:00
Simon Charette
10037130c1
Refs #28477 -- Fixed handling aliased annotations on aggregation.
Just like when using .annotate(), the .alias() method will generate the
necessary JOINs to resolve the alias even if not selected.

Since these JOINs could be multi-valued non-selected aggregates must be
considered to require subquery wrapping as a GROUP BY is required to
combine duplicated tuples from the base table.

Regression in 59bea9efd2768102fc9d3aedda469502c218e9b7.
2022-11-14 05:45:33 +01:00
Simon Charette
a9d2d8d1c3 Refs #28477 -- Reduced complexity of aggregation over qualify queries. 2022-11-11 08:46:08 +01:00
Simon Charette
59bea9efd2 Fixed #28477 -- Stripped unused annotations on aggregation.
Also avoid an unnecessary pushdown when aggregating over a query that doesn't
have aggregate annotations.
2022-11-09 13:22:14 +01:00
Jon Janzen
321ecb40f4 Fixed #34135 -- Added async-compatible interface to related managers. 2022-11-09 10:32:40 +01:00
Nick Pope
e0fb2a25b9
Used super().execute/executemany() in SQLiteCursorWrapper. 2022-11-08 14:19:59 +01:00
Ryan Cheley
8e6ea1d153 Fixed #10070 -- Added support for pyformat style parameters on SQLite.
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-11-08 12:26:39 +01:00
Jon Janzen
7b94847e38 Fixed #34139 -- Fixed acreate(), aget_or_create(), and aupdate_or_create() methods for related managers.
Bug in 58b27e0dbb3d31ca1438790870b2b51ecdb10500.
2022-11-08 06:20:10 +01:00
Simon Charette
76e37513e2 Refs #33374 -- Adjusted full match condition handling.
Adjusting WhereNode.as_sql() to raise an exception when encoutering a
full match just like with empty matches ensures that all case are
explicitly handled.
2022-11-07 20:23:53 +01:00
Florian Apolloner
7990d254b0
Refs #33308 -- Improved adapting DecimalField values to decimal. 2022-11-07 19:34:08 +01:00
Simon Charette
5f09ab8c30 Refs #17144 -- Removed support for grouping by primary key.
No core backend require the feature anymore as it was only added to
support a MySQL'ism that has been deprecated since then.
2022-11-07 12:21:29 +01:00
Simon Charette
041551d716 Fixed #31331 -- Switched MySQL to group by selected primary keys.
MySQL 5.7.15 supports group by functional dependences so there is no
need to special case group by main table primary key anymore and
special case the ONLY_FULL_GROUP_BY sql mode.
2022-11-07 11:36:05 +01:00
Simon Charette
967f8750ab Refs #27849 -- Fixed filtered aggregates crash on filters that match everything. 2022-11-07 09:05:24 +01:00
Bhuvnesh
123b1d3fcf
Fixed #34137 -- Made Model.refresh_from_db() clear cached generic relations.
Thanks Simon Charette for the implementation idea.
2022-11-07 08:06:30 +01:00
LightDiscord
e20c9eb60a Fixed #27654 -- Propagated alters_data attribute to callables overridden in subclasses.
Thanks Shai Berger and Adam Johnson for reviews and the implementation
idea.
2022-11-04 11:08:58 +01:00
Mariusz Felisiak
7b0e9ea53c
Fixed #34138 -- Avoided table rebuild when adding inline m2m fields on SQLite.
Regression in 2f73e5406d54cb8945e187eff302a3a3373350be.

Thanks David Wobrock for the report.
2022-11-04 09:30:23 +01:00
Nick Pope
0f4964535c Removed obsolete references to pysqlite.
Obsolete since 1b06d5e6f6be8e567ce78c892c485af039830d7d.
2022-11-04 08:03:06 +01:00
DevilsAutumn
d5bcdf858d Fixed #34112 -- Added async-compatible interface to Model methods.
Thanks Adam Johnson for the review.
2022-11-02 09:14:17 +01:00
Simon Charette
f47fec31f8 Refs #33768 -- Fixed ordering compound queries by NULLs on SQLite < 3.30.
The lack of support for native nulls last/first on SQLite 3.28 and 3.29
requires the compound query to be wrapped for emulation layer to work
properly.
2022-11-01 06:19:22 +01:00
Nick Pope
d3cb91db87 Used more augmented assignment statements.
Identified using the following command:

$ git grep -I '\(\<[_a-zA-Z0-9]\+\>\) *= *\1 *[-+/*^%&|<>@]'
2022-10-31 12:30:13 +01:00
David Wobrock
a320aab512 Fixed #16211 -- Added logical NOT support to F expressions. 2022-10-31 09:55:51 +01:00
Simon Charette
c2cc80756b
Fixed #34125 -- Fixed sliced QuerySet.union() crash on a single non-empty queryset.
The bug existed since sliced query union was added but was elevated to
query union slices by moving the .exists() optimization to the compiler
in 3d734c09ff0138441dfe0a59010435871d17950f.

Thanks Stefan Hammer for the report.
2022-10-29 09:21:25 +02:00
Simon Charette
09397f5cfa Used Query.is_sliced in SQLCompiler.as_sql(). 2022-10-28 08:46:33 +02:00
Mariusz Felisiak
80777d30b3 Refs #33173 -- Fixed destroying test databases when running tests in parallel using spawn on Windows.
Thanks Simon Willison for inspiration.
2022-10-26 09:42:51 +02:00
Mariusz Felisiak
6d41f5e5ed
Fixed DatabaseFeatures.supports_select_(intersection/difference) on MariaDB and MySQL 8.0.31+. 2022-10-25 20:01:25 +02:00