Simon Charette
a16eedcf9c
Fixed #35936 -- Used unnest for bulk inserts on Postgres when possible.
...
This should make bulk_create significantly faster on Postgres when provided
only literal values.
Thanks James Sewell for writing about this technique, Tom Forbes for
validating the performance benefits, David Sanders and Mariusz Felisiak
for the review.
2024-12-11 13:56:18 +01:00
Sarah Boyce
7380ac5734
Fixed #35688 -- Restored timezone and role setters to be PostgreSQL DatabaseWrapper methods.
...
Following the addition of PostgreSQL connection pool support in
Refs #33497 , the methods for configuring the database role and timezone
were moved to module-level functions. This change prevented subclasses
of DatabaseWrapper from overriding these methods as needed, for example,
when creating wrappers for other PostgreSQL-based backends.
Thank you Christian Hardenberg for the report and to
Florian Apolloner and Natalia Bidart for the review.
Regression in fad334e1a9
.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-08-28 19:25:07 -03:00
Mariusz Felisiak
b049bec7cf
Fixed #35479 -- Dropped support for PostgreSQL 13 and PostGIS 3.0.
2024-05-27 09:49:25 +02:00
Sarah Boyce
f973a70bfc
Made postgresql.tests.Tests.test_connect_pool less flaky by increasing timeout value.
2024-04-10 14:09:52 -03: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
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
Nick Pope
af6e7e3de8
Refs #34986 -- Fixed backends.postgresql.test_server_side_cursors.ServerSideCursorsPostgres tests for PyPy.
2023-12-07 09:43:20 +01:00
Nick Pope
2c6e4a29b0
Fixed typo in tests/backends/postgresql/test_server_side_cursors.py.
2023-12-06 09:17:49 +01:00
Mariusz Felisiak
779cd28acb
Fixed #34840 -- Avoided casting string base fields on PostgreSQL.
...
Thanks Alex Vandiver for the report.
Regression in 09ffc5c121
.
2023-09-22 06:01:11 +02:00
Mariusz Felisiak
2c6ebb65c9
Fixed #34851 -- Dropped support for PostgreSQL 12 and PostGIS 2.5.
2023-09-20 13:45:51 +02:00
Mariusz Felisiak
04eb1b4567
Refs #33872 -- Removed django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField.
...
Per deprecation timeline.
2023-09-18 22:12:40 +02:00
David Wobrock
9bbf97bcdb
Fixed #16055 -- Fixed crash when filtering against char/text GenericRelation relation on PostgreSQL.
2023-04-18 12:41:14 +02:00
Scott Macpherson
53aee470d5
Fixed #34486 -- Fixed DatabaseOperations.compose_sql() crash with no existing database connection on PostgreSQL.
...
Regression in 09ffc5c121
.
2023-04-14 10:11:33 +02:00
Mariusz Felisiak
5b8a043bf5
Fixed #34470 -- Enforced UTF-8 encoding on PostgreSQL.
...
Regression in 6a21658163
.
2023-04-07 10:11:41 +02:00
Anders Kaseorg
73cbb372ba
Fixed #34466 -- Reallowed setting cursor_factory in DATABASES["options"] on PostgreSQL.
...
Regression in 09ffc5c121
.
2023-04-07 08:02:34 +02:00
Mariusz Felisiak
0e2649fdf4
Fixed #34255 -- Made PostgreSQL backend use client-side parameters binding with psycopg version 3.
...
Thanks Guillaume Andreu Sabater for the report.
Co-authored-by: Florian Apolloner <apollo13@users.noreply.github.com>
2023-01-17 08:24:08 +01:00
Mike Crute
0b78ac3fc7
Fixed #34200 -- Made the session role configurable on PostgreSQL.
2023-01-03 09:30:53 +01:00
Daniele Varrazzo
09ffc5c121
Fixed #33308 -- Added support for psycopg version 3.
...
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews.
Co-authored-by: Florian Apolloner <florian@apolloner.eu>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-15 06:17:57 +01:00
Florian Apolloner
1d90c9b113
Refs #33308 -- Added psycopg_any.IsolationLevel.
2022-12-12 10:36:42 +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
9da2210f12
Avoided direct mocking of psycopg2.__version__ in test_correct_extraction_psycopg2_version().
2022-12-08 14:31:35 +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
Florian Apolloner
3cafb783f3
Refs #33308 -- Used psycopg's errors instead of errorcodes.
2022-12-01 09:17:33 +01:00
Mariusz Felisiak
cb791a2540
Fixed #33872 -- Deprecated django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField.
2022-08-03 11:42:51 +02:00
Mariusz Felisiak
981c23c0cc
Fixed #33717 -- Dropped support for PostgreSQL 11.
2022-05-19 09:26:48 +02:00
Mariusz Felisiak
37470bbd90
Fixed #33675 -- Dropped support for PostgreSQL 10 and PostGIS 2.4.
2022-05-04 06:28:51 +02:00
Florian Apolloner
2eea361eff
Fixed #30511 -- Used identity columns instead of serials on PostgreSQL.
2022-04-13 21:51:51 +02:00
Hasan Ramezani
9ac3ef59f9
Fixed #33379 -- Added minimum database version checks.
...
Thanks Tim Graham for the review.
2022-02-18 13:37:49 +01:00
django-bot
9c19aff7c7
Refs #33476 -- Reformatted code with Black.
2022-02-07 20:37:05 +01:00
Mariusz Felisiak
ca04659b4b
Refs #32355 -- Bumped required psycopg2 version to 2.8.4.
...
psycopg2 2.8.4 is the first release to support Python 3.8.
2021-12-22 20:32:55 +01:00
Daniel Hahler
98c8bf1cee
Fixed #33160 -- Avoided suppressing query errors in _nodb_cursor() on PostgreSQL.
2021-10-01 07:23:57 +02:00
Mateo Radman
2231429991
Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using "assert".
2021-07-05 13:31:03 +02: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
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
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
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
kingbuzzman
673fe2e3ec
Fixed #30148 -- Logged COPY ... TO statements in connection.queries on PostgreSQL.
2019-04-29 14:20:17 +02: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
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
Morgan Aubert
704443acac
Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().
2018-05-09 11:40:28 -04: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
a862af3839
Fixed #28893 -- Removed unnecessary dict.items() calls.
2017-12-06 17:17:59 -05:00
Mads Jensen
f0a68c2511
Fixed #28702 -- Made query lookups for CIText fields use citext.
2017-11-29 10:35:37 -05:00
Jon Dufresne
7a6fbf36b1
Fixed #28853 -- Updated connection.cursor() uses to use a context manager.
2017-11-28 11:28:09 -05:00