]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
13 days agotest(copy): cover the Python implementation in copy pinning tests
Daniele Varrazzo [Fri, 24 Oct 2025 15:09:15 +0000 (16:09 +0100)] 
test(copy): cover the Python implementation in copy pinning tests

13 days agofix(copy): restore selecting loader for each item
Jörg Breitbart [Thu, 23 Oct 2025 15:02:25 +0000 (17:02 +0200)] 
fix(copy): restore selecting loader for each item

In the copy refactoring released in 3.2.11 we changed the behaviour to
choosing a dumper at the first non-null value per column and keeping it.

Turns out more people than expected rely on the more flexible behaviour
of passing strings or types and letting postgres do the conversion.

Restore the previous behaviour; however it's possible to use
`copy.set_types()` to set dumpers per column and gain something in
performance.

Fix #1192

2 weeks agoMerge branch 'fix-1176' into maint-3.2
Daniele Varrazzo [Sun, 19 Oct 2025 02:40:59 +0000 (04:40 +0200)] 
Merge branch 'fix-1176' into maint-3.2

2 weeks agofix(pool): more robust placement of reconnection attempts
Daniele Varrazzo [Sat, 18 Oct 2025 15:48:32 +0000 (17:48 +0200)] 
fix(pool): more robust placement of reconnection attempts

The problem reported in #1176 is the close recursion already fixed.
However, because we try to reconnect before closing, we end up scheduling
a reconnection attempt for every recursion loop.

The recursion shouldn't happen anymore, but it seems more robust to
reconnect after the connection has been successfully closed, otherwise
we might end up requesting more connections than we ought (hopefully not
as dramatically as here anyway).

2 weeks agofix(pool): fix infinite loop with connections returning to the pool on close
bash000000 [Sat, 26 Jul 2025 13:44:49 +0000 (21:44 +0800)] 
fix(pool): fix infinite loop with connections returning to the pool on close

Reported in #1124 and fixed for the "official" psycopg 3.3 connection.
However the bug is also exposed by the connections hacked to return on close.

Might be the cause of the issue reported in #1176

2 weeks agoMerge branch 'maint-pool-3.2-backport' into maint-3.2
Daniele Varrazzo [Sun, 19 Oct 2025 00:20:02 +0000 (02:20 +0200)] 
Merge branch 'maint-pool-3.2-backport' into maint-3.2

This branch contained the changes in the maint-pool-3.2 that hadn't been
applied to the maint-3.2 branch.

The psycopg-pool code and tests in the maint-3.2 branch is now at the
same level of the maint-pool-3.2 branch but is much more modern, so
further psycopg-pool 3.2 will continue on this branch.

2 weeks agochore: bump psycopg_pool package version to 3.2.7.dev1
Daniele Varrazzo [Sun, 4 May 2025 23:05:36 +0000 (01:05 +0200)] 
chore: bump psycopg_pool package version to 3.2.7.dev1

2 weeks agochore: bump psycopg_pool package version to 3.2.6
Daniele Varrazzo [Tue, 25 Feb 2025 21:08:48 +0000 (22:08 +0100)] 
chore: bump psycopg_pool package version to 3.2.6

2 weeks agofix(pool): reset connection transaction status after failed check
Kanav Kalucha [Tue, 25 Feb 2025 18:28:38 +0000 (10:28 -0800)] 
fix(pool): reset connection transaction status after failed check

Close #1014

2 weeks agochore: bump psycopg_pool package version to 3.2.5
Daniele Varrazzo [Fri, 21 Feb 2025 21:23:30 +0000 (22:23 +0100)] 
chore: bump psycopg_pool package version to 3.2.5

2 weeks agofix(pool): check that there is some connection in the pool before shrinking
Daniele Varrazzo [Fri, 21 Feb 2025 16:27:29 +0000 (17:27 +0100)] 
fix(pool): check that there is some connection in the pool before shrinking

There is a race condition between shrinking the pool and closing an
expired connection which might result in attempting to pop from the
empty _pool deque. Add a check to prevent that.

The bug is not serious as it doesn't compromise the pool working but it causes
noise in the logging.

Close #1001

2 weeks agochore: bump psycopg package version to 3.2.12.dev1
Daniele Varrazzo [Sat, 18 Oct 2025 23:43:19 +0000 (01:43 +0200)] 
chore: bump psycopg package version to 3.2.12.dev1

2 weeks agochore: adapt license metadata to license expression 3.2.11
Daniele Varrazzo [Sat, 18 Oct 2025 21:00:19 +0000 (23:00 +0200)] 
chore: adapt license metadata to license expression

2 weeks agofest: mark test flakey to unblock wheel packages
Daniele Varrazzo [Sat, 18 Oct 2025 17:08:33 +0000 (19:08 +0200)] 
fest: mark test flakey to unblock wheel packages

Only the job linux ppc64le, cp314, manylinux fails.

https://github.com/psycopg/psycopg/actions/runs/18616057170/job/53085510661

2 weeks agoci: fix proxy-based tests
Daniele Varrazzo [Sat, 18 Oct 2025 11:36:12 +0000 (13:36 +0200)] 
ci: fix proxy-based tests

Move pproxy_fix out of tests package and use it as a script. Importing
it fails in cibuildwheel otherwise

Exclude the proxy test on Win/macOS. They don't work there, but for all
other test they got skipped as side effects of other markers.

2 weeks agochore: bump psycopg package version to 3.2.11
Daniele Varrazzo [Sat, 18 Oct 2025 11:18:20 +0000 (13:18 +0200)] 
chore: bump psycopg package version to 3.2.11

2 weeks agoMerge pull request #1187 from dvarrazzo/perf/transpose-loading
Daniele Varrazzo [Sat, 18 Oct 2025 02:10:19 +0000 (04:10 +0200)] 
Merge pull request #1187 from dvarrazzo/perf/transpose-loading

Improve loading performance by transposing row-col loading order

2 weeks agoperf: load results by row rather than by column 1187/head
Jörg Breitbart [Thu, 16 Oct 2025 00:01:32 +0000 (02:01 +0200)] 
perf: load results by row rather than by column

In the past we were converting results to Python tuples proceeding
column by column. The rationale was that certain overhead such as
selecting the loader was to be paid only once per column, not once per
datum.

However this analysis was dismantled in #1163, see especially the comment at
https://github.com/psycopg/psycopg/pull/1163#issuecomment-3288921422
for some benchmark comparing various conversion strategies. In the end,
the simple row-by-row loading in a single function ends up being more
performing. Performance now surpasses the one of psycopg2.

See also #1155 for an initial analysis of performance regression.

A big thank you to Jörg Breitbart (@jerch) for this improvement!

3 weeks agoMerge branch 'fix/binary-copy-rowlevel-3.2' into maint-3.2
Daniele Varrazzo [Wed, 15 Oct 2025 23:23:21 +0000 (01:23 +0200)] 
Merge branch 'fix/binary-copy-rowlevel-3.2' into maint-3.2

3 weeks agorefactor: drop copy format code path with buffer creation
Daniele Varrazzo [Tue, 14 Oct 2025 00:35:48 +0000 (02:35 +0200)] 
refactor: drop copy format code path with buffer creation

The path is unused and leads to more convoluted code.

3 weeks agofix(c): fix copy buffer corruption on dumping error
Jörg Breitbart [Wed, 3 Sep 2025 08:04:04 +0000 (10:04 +0200)] 
fix(c): fix copy buffer corruption on dumping error

Restore the buffer so that if we trap the exception and continue in
Python the buffer will not be corrupted.

Improve on the #1147 fix.

3 weeks agotest: add test to reveal the buffer corruption on dump error
Daniele Varrazzo [Tue, 14 Oct 2025 01:41:34 +0000 (03:41 +0200)] 
test: add test to reveal the buffer corruption on dump error

3 weeks agoMerge branch 'fix/set-types-text' into maint-3.2
Daniele Varrazzo [Tue, 14 Oct 2025 01:19:37 +0000 (03:19 +0200)] 
Merge branch 'fix/set-types-text' into maint-3.2

3 weeks agodocs: mention issue #1153 fix in news file
Daniele Varrazzo [Mon, 13 Oct 2025 13:31:10 +0000 (15:31 +0200)] 
docs: mention issue #1153 fix in news file

3 weeks agofix: consistent error passing a row with mismatched size to copy
Daniele Varrazzo [Mon, 13 Oct 2025 13:30:04 +0000 (15:30 +0200)] 
fix: consistent error passing a row with mismatched size to copy

3 weeks agofix(c): respect the set_types() definitions in text format
Jörg Breitbart [Thu, 4 Sep 2025 14:27:13 +0000 (16:27 +0200)] 
fix(c): respect the set_types() definitions in text format

Fix #1153

3 weeks agotest: add test to reproduce set_types being ignored
Daniele Varrazzo [Thu, 4 Sep 2025 09:43:03 +0000 (11:43 +0200)] 
test: add test to reproduce set_types being ignored

It has been reported ignored in the C implementation in binary format. See #1153

3 weeks agoci: enable tests on PR
Daniele Varrazzo [Mon, 13 Oct 2025 12:34:29 +0000 (14:34 +0200)] 
ci: enable tests on PR

They shouldn't be duplicated anymore if we develop in private forks of
the repo.

3 weeks agotest: longer sleep to test for idle timeout exception
Daniele Varrazzo [Mon, 13 Oct 2025 12:49:59 +0000 (14:49 +0200)] 
test: longer sleep to test for idle timeout exception

The test fails semi-regularly on macOS (probably 5% of the times).

3 weeks agoMerge branch 'fix/wait-rw-3.2' into maint-3.2
Daniele Varrazzo [Mon, 13 Oct 2025 11:26:25 +0000 (13:26 +0200)] 
Merge branch 'fix/wait-rw-3.2' into maint-3.2

3 weeks agotest: make AEvent.wait_timeout() return False on timeout
Daniele Varrazzo [Mon, 15 Sep 2025 23:41:35 +0000 (01:41 +0200)] 
test: make AEvent.wait_timeout() return False on timeout

For better similarity to Event.wait().

3 weeks agofix: consider a connection closed in poll() only if it's not ready too
Daniele Varrazzo [Sat, 11 Oct 2025 01:26:40 +0000 (03:26 +0200)] 
fix: consider a connection closed in poll() only if it's not ready too

When closing the proxy and trying to communicate, poll returns state 25
on the connection, i.e. POLLIN | POLLERR | POLLHUP. The connection is
not closed though, so we might end up in weird state ahead (e.g. connection
stuck in ACTIVE).

Because it's suggested that the connection is readable, do read from it.
Likely a proper error will be raised downstream, but we will remain in
consistent state.

3 weeks agotest: fix decorator to skip tests on crdb because of any db name accepted
Daniele Varrazzo [Mon, 15 Sep 2025 22:34:24 +0000 (00:34 +0200)] 
test: fix decorator to skip tests on crdb because of any db name accepted

3 weeks agofix(c): fix timeout calculation in select-based wait function
Daniele Varrazzo [Fri, 10 Oct 2025 13:17:54 +0000 (15:17 +0200)] 
fix(c): fix timeout calculation in select-based wait function

Because of the error, the timeout set to 0, resulting in a busy loop
instead of waiting.

Might fix #645.

3 weeks agoci: use working test server on macOS
Daniele Varrazzo [Sun, 12 Oct 2025 02:38:24 +0000 (04:38 +0200)] 
ci: use working test server on macOS

macos-14 can use PostgreSQL 18. I saw a failure trying to use 17; not
sure if it's still there but 18 works fine, so bump.

macos-13 better says on 17. Trying to "brew update" it will pull a
version that will try to compile docbook and takes forever to install. I
understand that avoid an upgrade we get a version that has a binary
package ("bottled", in this deranged naming convention).

3 weeks agorefactor: check for closed connection in wait functions
Daniele Varrazzo [Tue, 7 Oct 2025 23:49:52 +0000 (01:49 +0200)] 
refactor: check for closed connection in wait functions

Catch and display errors in a more homogeneous way: if a wait function
finds a connection closed it will raise an OperationalError chained to
the OSError obtained from stat'ing the socket. Previously control would
have gone back to the generator with a read-ready state and it would
have failed on whatever libpq function would have touched the socket.

Fix the problem reported in #608 affecting the epoll wait function, for
which we opted to use the poll function instead (which, more simply,
made the closed fd easier to spot).

note that on Windows it's not possible to use os.fstat() to ckeck a
socket state, therefore make it no-op.

3 weeks agoci: test with PostgreSQL 18 final image
Daniele Varrazzo [Sun, 12 Oct 2025 08:20:23 +0000 (10:20 +0200)] 
ci: test with PostgreSQL 18 final image

3 weeks agotest: improve wait functions tests
Daniele Varrazzo [Sun, 14 Sep 2025 15:46:34 +0000 (17:46 +0200)] 
test: improve wait functions tests

Check for consistent behaviour and expected result. The test currently
pass on the Python module and highlight shortcoming in the C function.

Complete wait async test, generate sync version automatically.

See #1141

3 weeks agorefactor(wait): disallow interval=None in wait functions
Daniele Varrazzo [Sun, 14 Sep 2025 15:10:33 +0000 (17:10 +0200)] 
refactor(wait): disallow interval=None in wait functions

It is not used internally: we always use an interval to allow for
Ctrl-C. It causes ambiguity with 0, which might be a value useful for
polling.

3 weeks agofix: fix return values of wait_poll(), wait_epoll()
Daniele Varrazzo [Sun, 14 Sep 2025 03:40:11 +0000 (05:40 +0200)] 
fix: fix return values of wait_poll(), wait_epoll()

3 weeks agofix(c): fix polling for read+write
Arshia Ghafoori [Wed, 27 Aug 2025 10:26:01 +0000 (14:26 +0400)] 
fix(c): fix polling for read+write

3 weeks agoMerge branch 'bump-libs-3.2' into maint-3.2
Daniele Varrazzo [Mon, 13 Oct 2025 11:25:11 +0000 (13:25 +0200)] 
Merge branch 'bump-libs-3.2' into maint-3.2

3 weeks agoci: add workflow to build and cache the libpq
Daniele Varrazzo [Sun, 12 Oct 2025 00:28:06 +0000 (02:28 +0200)] 
ci: add workflow to build and cache the libpq

This avoid to attempt building the libpq concurrently with every Python
version, which will make caching fail.

3 weeks agochore(binary): bump packaged versions of libpq, OpenSSL
Daniele Varrazzo [Fri, 10 Oct 2025 13:06:06 +0000 (15:06 +0200)] 
chore(binary): bump packaged versions of libpq, OpenSSL

3 weeks agoUpdate DEFAULT_AUTO_FIELD setting in Django CI workflow (#1182)
Jacob Walls [Fri, 10 Oct 2025 16:48:32 +0000 (18:48 +0200)] 
Update DEFAULT_AUTO_FIELD setting in Django CI workflow (#1182)

* test(django): Remove DEFAULT_AUTO_FIELD setting

Refs https://github.com/django/django-docker-box/pull/59

* test(django): use DEFAULT_AUTO_FIELD for LTS4 and LTS5

Not to be used from main on.

---------

Co-authored-by: Daniele Varrazzo <daniele.varrazzo@gmail.com>
3 weeks agochore(deps): bump the actions group across 1 directory with 5 updates (#1181)
dependabot[bot] [Fri, 10 Oct 2025 14:35:53 +0000 (15:35 +0100)] 
chore(deps): bump the actions group across 1 directory with 5 updates (#1181)

Bumps the actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4` | `5` |
| [actions/setup-python](https://github.com/actions/setup-python) | `5` | `6` |
| [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) | `3` | `4` |
| [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) | `3.1.4` | `3.2.0` |
| [actions/github-script](https://github.com/actions/github-script) | `7` | `8` |

Updates `actions/checkout` from 4 to 5
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

Updates `actions/setup-python` from 5 to 6
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

Updates `peter-evans/repository-dispatch` from 3 to 4
- [Release notes](https://github.com/peter-evans/repository-dispatch/releases)
- [Commits](https://github.com/peter-evans/repository-dispatch/compare/v3...v4)

Updates `pypa/cibuildwheel` from 3.1.4 to 3.2.0
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v3.1.4...v3.2.0)

Updates `actions/github-script` from 7 to 8
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: peter-evans/repository-dispatch
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/github-script
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 weeks agoci: fix bad expansion of an array variable in build_libpq.sh
ubifred [Fri, 10 Oct 2025 11:35:35 +0000 (13:35 +0200)] 
ci: fix bad expansion of an array variable in build_libpq.sh

* ci: fix bad expansion of an array variable in build_libpq.sh

The `options` array variable have been introduced in
`adb8336a392a71a3cb2ddf18bd9b17238a01a06e` but is used with `$options`
which only expand the 1st value (for bash).

The full expansion have to be done with `${options[*]}`

Note that `-shared` and `-fPIC` options are still used as they are
enabled by default by `./Configure`, but the `zlib` option is not taken
into account (disabled by default)

* ci: fix wrong command

`./configure` does not exists

Fix #1178

7 weeks agoMerge branch 'fix/binary-copy' into maint-3.2
Daniele Varrazzo [Tue, 16 Sep 2025 00:18:14 +0000 (02:18 +0200)] 
Merge branch 'fix/binary-copy' into maint-3.2

7 weeks agofix(copy): avoid sending copy data if an error is set
Daniele Varrazzo [Mon, 1 Sep 2025 16:06:43 +0000 (18:06 +0200)] 
fix(copy): avoid sending copy data if an error is set

It would result in a partial message. The server seems to do the right
thing anyway, but let's not waste its precious time.

7 weeks agofix(c): fix excessive buffer allocation in binary copy
Daniele Varrazzo [Mon, 1 Sep 2025 15:22:34 +0000 (17:22 +0200)] 
fix(c): fix excessive buffer allocation in binary copy

Fix #1147

7 weeks agoMerge branch 'fix-builtin-dumper-loader' into maint-3.2
Daniele Varrazzo [Tue, 16 Sep 2025 00:12:13 +0000 (02:12 +0200)] 
Merge branch 'fix-builtin-dumper-loader' into maint-3.2

7 weeks agofix: drop warning for objects passed as JSON lods/dump function
Daniele Varrazzo [Wed, 10 Sep 2025 19:55:02 +0000 (21:55 +0200)] 
fix: drop warning for objects passed as JSON lods/dump function

Just optimistically assume that they are ok and will not cause leaks.
The possibility of there being something else which might cause a leak
is lower than the possibility that we didn't think about something else
and raise a warning, refusing to cache the loader, and really cause a
leak.

7 weeks agofix: don't raise a warning using a builtin for JSON dumps/loads
Daniele Varrazzo [Wed, 10 Sep 2025 10:07:46 +0000 (12:07 +0200)] 
fix: don't raise a warning using a builtin for JSON dumps/loads

These types are stable so will not leak. However they have no
code/closure dunder attr so they will raise a warning.

Fix #1165.

8 weeks agochore: remove ignore unneeded in mypy >= 1.18.1
Daniele Varrazzo [Fri, 12 Sep 2025 15:18:37 +0000 (17:18 +0200)] 
chore: remove ignore unneeded in mypy >= 1.18.1

We can't bump the min mypy on this maintenance branch because it doesn't
support Python 3.8, therefore ignore warnings in this file to
accommodate the min supported mypy version 1.14.

8 weeks agotest: fix tests with master version of crdb
Daniele Varrazzo [Fri, 12 Sep 2025 15:14:00 +0000 (17:14 +0200)] 
test: fix tests with master version of crdb

The server version reported is 250300. Tests fail with the error:

    psycopg.errors.OperatorIntervention: this schema change is
    disallowed because table "execmany" is locked and this operation cannot
    automatically unlock the table

    DETAIL:  To unlock the table, execute `ALTER TABLE execmany SET (schema_locked = false);`

    After the schema change completes, we recommend setting it back to
    true with `ALTER TABLE execmany SET (schema_locked = true);`.

    HINT:  Locking the table improves changefeed performance; see
    https://www.cockroachlabs.com/docs/dev/changefeed-best-practices.html#lock-the-schema-on-changefeed-watched-tables

8 weeks agochore(ci): bump crdb test versions
Daniele Varrazzo [Fri, 12 Sep 2025 15:13:38 +0000 (17:13 +0200)] 
chore(ci): bump crdb test versions

8 weeks agoci: run lint/tests in any branches
Daniele Varrazzo [Fri, 12 Sep 2025 14:33:23 +0000 (16:33 +0200)] 
ci: run lint/tests in any branches

The `*` results in branches with a `/` excluded.

Also exclude running tests if only docs change.

8 weeks agofix: typo in notifications warning
Daniele Varrazzo [Mon, 8 Sep 2025 11:06:44 +0000 (13:06 +0200)] 
fix: typo in notifications warning

8 weeks agoci: use stable runner windows-2022
Daniele Varrazzo [Sun, 7 Sep 2025 14:12:50 +0000 (16:12 +0200)] 
ci: use stable runner windows-2022

Soon the `-latest` image will become -2025.

8 weeks agochore: bump psycopg package version to 3.2.11.dev1
Daniele Varrazzo [Mon, 8 Sep 2025 09:14:43 +0000 (11:14 +0200)] 
chore: bump psycopg package version to 3.2.11.dev1

2 months agochore: bump psycopg package version to 3.2.10 3.2.10
Daniele Varrazzo [Sun, 7 Sep 2025 15:44:54 +0000 (17:44 +0200)] 
chore: bump psycopg package version to 3.2.10

2 months agoMerge branch 'pg18-3.2' into maint-3.2
Daniele Varrazzo [Sun, 7 Sep 2025 13:54:22 +0000 (15:54 +0200)] 
Merge branch 'pg18-3.2' into maint-3.2

2 months agodocs: mention PostgreSQL v18 support
Daniele Varrazzo [Sun, 11 May 2025 20:50:58 +0000 (22:50 +0200)] 
docs: mention PostgreSQL v18 support

2 months agoci: add PostgreSQL 18 to the test grid
Daniele Varrazzo [Sun, 7 Sep 2025 00:35:30 +0000 (02:35 +0200)] 
ci: add PostgreSQL 18 to the test grid

2 months agochore: add PostgreSQL 18 exceptions
Daniele Varrazzo [Sun, 11 May 2025 20:48:26 +0000 (22:48 +0200)] 
chore: add PostgreSQL 18 exceptions

2 months agofix: add ConnStatus.CONNECTION_AUTHENTICATING value
Daniele Varrazzo [Sun, 11 May 2025 20:43:00 +0000 (22:43 +0200)] 
fix: add ConnStatus.CONNECTION_AUTHENTICATING value

Introduced in PostgreSQL 18

2 months agoMerge branch 'fix-1091' into maint-3.2
Daniele Varrazzo [Sun, 7 Sep 2025 11:42:36 +0000 (13:42 +0200)] 
Merge branch 'fix-1091' into maint-3.2

2 months agodocs: document the changes to notifies generator 1092/head
Daniele Varrazzo [Sat, 6 Sep 2025 21:44:42 +0000 (23:44 +0200)] 
docs: document the changes to notifies generator

2 months agofix: raise a warning when notifies generator and handlers are used together
Daniele Varrazzo [Sat, 6 Sep 2025 22:14:48 +0000 (00:14 +0200)] 
fix: raise a warning when notifies generator and handlers are used together

2 months agofix: collect notifies only if no handler was registered
Daniele Varrazzo [Wed, 14 May 2025 15:16:03 +0000 (17:16 +0200)] 
fix: collect notifies only if no handler was registered

If someone is listening to notifications by using an handler, the
notifies backlog would fill without ever being emptied.

This change has the risk of breaking something if someone is relying on
notifies being received both via callback and via generator, but I don't
know how to satisfy it without creating a leak to users who don't use the
generator. Will ask around...

Fix #1091.

2 months agoci: move minimum SQLAlchemy git main Python version to 3.10
Daniele Varrazzo [Sat, 6 Sep 2025 18:31:35 +0000 (20:31 +0200)] 
ci: move minimum SQLAlchemy git main Python version to 3.10

2 months agoci: run packages build on workflow file change
Daniele Varrazzo [Sat, 6 Sep 2025 18:32:59 +0000 (20:32 +0200)] 
ci: run packages build on workflow file change

2 months agoMerge branch 'fix-executemany-lock-3.2' into maint-3.2
Daniele Varrazzo [Sat, 6 Sep 2025 19:18:51 +0000 (21:18 +0200)] 
Merge branch 'fix-executemany-lock-3.2' into maint-3.2

2 months agofix: keep a lock for the entire duration of executemany 1159/head
Daniele Varrazzo [Sat, 6 Sep 2025 01:00:24 +0000 (03:00 +0200)] 
fix: keep a lock for the entire duration of executemany

Before this change we had the lock context inside the pipeline context,
because conn.pipepline() and Pipeline.__enter/exit__ take a lock. But
this created windows of opportunities for other threads to execute
concurrent operations on the connection, resulting in "another command
is already in progress" errors.

Fix #1130.

2 months agorefactor: auto-generate sync pipeline object from async one
Daniele Varrazzo [Fri, 5 Sep 2025 23:57:52 +0000 (01:57 +0200)] 
refactor: auto-generate sync pipeline object from async one

2 months agorefactor: separate sync/async pipeline in their own modules
Daniele Varrazzo [Fri, 5 Sep 2025 23:48:48 +0000 (01:48 +0200)] 
refactor: separate sync/async pipeline in their own modules

2 months agofix: fix excessive buffer resizing on int16 dump
jerch [Sat, 6 Sep 2025 14:47:31 +0000 (16:47 +0200)] 
fix: fix excessive buffer resizing on int16 dump

Fix #1160

2 months agoMerge pull request #1137 from psycopg/gssapi-warning
Daniele Varrazzo [Fri, 5 Sep 2025 21:59:47 +0000 (23:59 +0200)] 
Merge pull request #1137 from psycopg/gssapi-warning

Warn about implicit use of GSS-API

2 months agofeat: raise a warning if a GSS connection is obtained using the libpq default 1137/head
Daniele Varrazzo [Tue, 26 Aug 2025 01:28:16 +0000 (03:28 +0200)] 
feat: raise a warning if a GSS connection is obtained using the libpq default

Suggest the user to specify a 'gssencmode' setting explicitly so that,
in the future, we will be able to change the setting default to 'disable'.

See #1136

2 months agofeat: add support for libpq PQconnectionUsedGSSAPI()
Daniele Varrazzo [Mon, 25 Aug 2025 16:35:30 +0000 (18:35 +0200)] 
feat: add support for libpq PQconnectionUsedGSSAPI()

We will not advertise its presence as PGconn.used_gssapi until Psycopg
3.3. However we can use it internally to implement a warning to check
the implicit usage of gssencmode=prefer.

See #1136

2 months agoMerge branch 'py314-3.2' into maint-3.2
Daniele Varrazzo [Tue, 2 Sep 2025 22:26:28 +0000 (00:26 +0200)] 
Merge branch 'py314-3.2' into maint-3.2

2 months agodocs: mention Python 3.14 support in news file
Daniele Varrazzo [Tue, 2 Sep 2025 22:23:15 +0000 (00:23 +0200)] 
docs: mention Python 3.14 support in news file

2 months agoci: drop i686 binary packages
Daniele Varrazzo [Mon, 1 Sep 2025 09:31:24 +0000 (11:31 +0200)] 
ci: drop i686 binary packages

Not happy to drop them in a bugfix release, it seems possible to still
produce them with current cibuildwheel, but the documentation doesn't
make obvious how to restore them.

We will try to restore them if someone complains.

2 months agochore(pool): use coro test from inspect instead of asyncio
Daniele Varrazzo [Mon, 1 Sep 2025 09:23:59 +0000 (11:23 +0200)] 
chore(pool): use coro test from inspect instead of asyncio

The latter is deprecated in Python 3.14.

2 months agotest: fix pproxy compatibility with Python 3.14
Daniele Varrazzo [Sun, 31 Aug 2025 19:20:50 +0000 (21:20 +0200)] 
test: fix pproxy compatibility with Python 3.14

Work around the issue reported in https://github.com/qwj/python-proxy/issues/200

2 months agoci: test with Python 3.14 non-dev
Daniele Varrazzo [Fri, 29 Aug 2025 18:11:05 +0000 (20:11 +0200)] 
ci: test with Python 3.14 non-dev

2 months agochore(test): drop use of asyncio event loop policy
Daniele Varrazzo [Fri, 29 Aug 2025 16:52:42 +0000 (18:52 +0200)] 
chore(test): drop use of asyncio event loop policy

Deprecated since Python 3.14

2 months agoci(alpine): install missing libraris required to test and package wheels
Daniele Varrazzo [Fri, 29 Aug 2025 15:11:54 +0000 (17:11 +0200)] 
ci(alpine): install missing libraris required to test and package wheels

Since some recent alpine version the krb5-libs package is not installed by
default anymore. When building the libpq the package got installed as a
side effect of installing krb5-dev, but, in case libpq build was cached,
the libraries would have been missing when packaging the wheel or
importing psycopg for test.

2 months agochore: bump cibuildwheel to 3.1.4
Daniele Varrazzo [Tue, 26 Aug 2025 15:54:24 +0000 (17:54 +0200)] 
chore: bump cibuildwheel to 3.1.4

It should help with Python 3.14 builds.

2 months agochore: add Python 3.14 to supported version metadata and docs
Daniele Varrazzo [Tue, 29 Apr 2025 12:26:39 +0000 (14:26 +0200)] 
chore: add Python 3.14 to supported version metadata and docs

2 months agoci: add Python 3.14 dev to package build
Daniele Varrazzo [Tue, 29 Apr 2025 12:26:15 +0000 (14:26 +0200)] 
ci: add Python 3.14 dev to package build

2 months agoci: add Python 3.14 version to test grid
Daniele Varrazzo [Sun, 27 Apr 2025 21:47:15 +0000 (23:47 +0200)] 
ci: add Python 3.14 version to test grid

2 months agochore: bump Cython version
Daniele Varrazzo [Wed, 21 May 2025 16:54:43 +0000 (18:54 +0200)] 
chore: bump Cython version

Skip version 3.1.0 because of https://github.com/cython/cython/issues/6850
I understand that >= 3.1.0 is required for the free threading support (#1096).

2 months agotest: use current timezone name
Daniele Varrazzo [Tue, 19 Aug 2025 14:51:35 +0000 (16:51 +0200)] 
test: use current timezone name

3 months agoMerge branch 'fix-binary-version' into maint-3.2
Daniele Varrazzo [Wed, 23 Jul 2025 00:32:58 +0000 (02:32 +0200)] 
Merge branch 'fix-binary-version' into maint-3.2

3 months agofix(binary): fix __version__
Daniele Varrazzo [Tue, 22 Jul 2025 01:31:15 +0000 (03:31 +0200)] 
fix(binary): fix __version__

It was taken from the psycopg-c package, so it might have been wrong or,
more likely, reported as 0.0.0.0 because not installed.

3 months agotest: verify the version is sane
Daniele Varrazzo [Tue, 22 Jul 2025 00:33:22 +0000 (02:33 +0200)] 
test: verify the version is sane

3 months agochore: ignore mypy flag for unused ignore
Daniele Varrazzo [Tue, 22 Jul 2025 11:50:27 +0000 (13:50 +0200)] 
chore: ignore mypy flag for unused ignore

Flagged by mypy 1.17 on CI, but we need to stay on mypy 1.14 in the
maint 3.2 branch because of Python 3.8 compatibility.

3 months agoci: avoid running jobs on pull requests
Daniele Varrazzo [Sun, 11 May 2025 12:06:55 +0000 (14:06 +0200)] 
ci: avoid running jobs on pull requests

Jobs run anyway on push. This setting results in duplicate runs.

3 months agoMerge pull request #1119 from psycopg/fix-cancelled-error-shadowing
Daniele Varrazzo [Sat, 12 Jul 2025 04:38:39 +0000 (05:38 +0100)] 
Merge pull request #1119 from psycopg/fix-cancelled-error-shadowing

Avoid a TypeError shadowing CancelledError on task cancellation