]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
4 days agoMerge pull request #1247 from ewie/fix-operationerror-pgconn master
Daniele Varrazzo [Sun, 25 Jan 2026 13:10:20 +0000 (14:10 +0100)] 
Merge pull request #1247 from ewie/fix-operationerror-pgconn

fix: retain pgconn on OperationalError

4 days agofix: retain pgconn on OperationalError 1247/head
Erik Wienhold [Wed, 14 Jan 2026 13:42:18 +0000 (14:42 +0100)] 
fix: retain pgconn on OperationalError

When multiple connection attempts fail, a new OperationalError with the
combined attempt errors is raised without retaining the pgconn attribute
of the original attempt errors.  Fix this by assigning the pgconn from
the last attempt error.

8 days agochore: update black to 26.1, re-lint codebase
Daniele Varrazzo [Wed, 21 Jan 2026 22:51:23 +0000 (23:51 +0100)] 
chore: update black to 26.1, re-lint codebase

Much better, thank you!

4 weeks agochore(deps): bump the actions group with 2 updates
dependabot[bot] [Thu, 1 Jan 2026 07:10:50 +0000 (07:10 +0000)] 
chore(deps): bump the actions group with 2 updates

Bumps the actions group with 2 updates: [actions/cache](https://github.com/actions/cache) and [actions/upload-artifact](https://github.com/actions/upload-artifact).

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

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

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
6 weeks agochore(ci): drop macos 13 jobs
Daniele Varrazzo [Mon, 15 Dec 2025 13:16:57 +0000 (14:16 +0100)] 
chore(ci): drop macos 13 jobs

Runners closing down in Gitlab Action.

7 weeks agochore(deps): bump the actions group with 2 updates
dependabot[bot] [Mon, 1 Dec 2025 07:39:07 +0000 (07:39 +0000)] 
chore(deps): bump the actions group with 2 updates

Bumps the actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel).

Updates `actions/checkout` from 5 to 6
- [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/v5...v6)

Updates `pypa/cibuildwheel` from 3.2.1 to 3.3.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.2.1...v3.3.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
7 weeks agochore: bump psycopg package version to 3.3.3.dev1
Daniele Varrazzo [Sat, 6 Dec 2025 17:41:22 +0000 (18:41 +0100)] 
chore: bump psycopg package version to 3.3.3.dev1

7 weeks agochore: bump psycopg package version to 3.3.2 3.3.2
Daniele Varrazzo [Fri, 5 Dec 2025 13:23:23 +0000 (14:23 +0100)] 
chore: bump psycopg package version to 3.3.2

7 weeks agoMerge pull request #1231 from noirbee/fix/1230-adapter-get-dumper-race-condition
Daniele Varrazzo [Fri, 5 Dec 2025 13:21:23 +0000 (14:21 +0100)] 
Merge pull request #1231 from noirbee/fix/1230-adapter-get-dumper-race-condition

Avoid race condition when replacing class name with itself

7 weeks agofix(adapters): avoid race condition when replacing class name with itself 1231/head
Nicolas Noirbent [Wed, 3 Dec 2025 15:58:25 +0000 (16:58 +0100)] 
fix(adapters): avoid race condition when replacing class name with itself

Another thread may be switched to between the dmap.pop(fqn) instruction
and the dmap[scls] one, typically at program startup when multiple
threads are making their "first" queries.

Close #1230

7 weeks agofix: mark external libpq C functions as noexcept nogil
Lysandros Nikolaou [Fri, 28 Nov 2025 14:05:04 +0000 (15:05 +0100)] 
fix: mark external libpq C functions as noexcept nogil

Add noexcept nogil declarations to libpq bindings and endian conversion
functions. This improves things for when we start using critical
sections inside Cython-defines types. It's also more accurate this way,
instead of only marking the APIs that are explicitly used in a nogil
block.

8 weeks agodocs: larger font for 3.3.0 release
Daniele Varrazzo [Tue, 2 Dec 2025 21:45:44 +0000 (22:45 +0100)] 
docs: larger font for 3.3.0 release

8 weeks agochore: bump psycopg package version to 3.3.2.dev1
Daniele Varrazzo [Tue, 2 Dec 2025 21:28:38 +0000 (22:28 +0100)] 
chore: bump psycopg package version to 3.3.2.dev1

8 weeks agochore: bump psycopg package version to 3.3.1 3.3.1
Daniele Varrazzo [Tue, 2 Dec 2025 19:10:09 +0000 (20:10 +0100)] 
chore: bump psycopg package version to 3.3.1

8 weeks agoMerge branch 'fix/server-cursor-iter'
Daniele Varrazzo [Tue, 2 Dec 2025 19:09:46 +0000 (20:09 +0100)] 
Merge branch 'fix/server-cursor-iter'

8 weeks agofix: fix iteration on server-side cursor 1227/head
Daniele Varrazzo [Tue, 2 Dec 2025 18:01:53 +0000 (19:01 +0100)] 
fix: fix iteration on server-side cursor

Close #1226

8 weeks agofix: add test to verify iteration in server-side cursor broken
Daniele Varrazzo [Tue, 2 Dec 2025 17:54:26 +0000 (18:54 +0100)] 
fix: add test to verify iteration in server-side cursor broken

See #1226

8 weeks agochore: bump psycopg_pool package version to 3.3.1.dev1
Daniele Varrazzo [Tue, 2 Dec 2025 17:53:17 +0000 (18:53 +0100)] 
chore: bump psycopg_pool package version to 3.3.1.dev1

8 weeks agochore: bump psycopg package version to 3.3.1.dev1
Daniele Varrazzo [Tue, 2 Dec 2025 17:53:09 +0000 (18:53 +0100)] 
chore: bump psycopg package version to 3.3.1.dev1

8 weeks agochore: bump psycopg_pool package version to 3.3.0 chore/release-3.3 pool-3.3.0
Daniele Varrazzo [Mon, 1 Dec 2025 03:19:11 +0000 (04:19 +0100)] 
chore: bump psycopg_pool package version to 3.3.0

8 weeks agochore: bump psycopg package version to 3.3.0 3.3.0
Daniele Varrazzo [Mon, 1 Dec 2025 03:18:59 +0000 (04:18 +0100)] 
chore: bump psycopg package version to 3.3.0

8 weeks agofix: mark new register_composite() args as keyword only
Daniele Varrazzo [Mon, 1 Dec 2025 02:55:51 +0000 (03:55 +0100)] 
fix: mark new register_composite() args as keyword only

8 weeks agoMerge pull request #1222 from dvarrazzo/fix/composite-adapt-info
Daniele Varrazzo [Mon, 1 Dec 2025 02:06:39 +0000 (03:06 +0100)] 
Merge pull request #1222 from dvarrazzo/fix/composite-adapt-info

Pass the entire info object to composite adapters customization functions

8 weeks agofix(composite): pass the entire info object to the custom functions 1222/head
Daniele Varrazzo [Sun, 30 Nov 2025 23:27:01 +0000 (00:27 +0100)] 
fix(composite): pass the entire info object to the custom functions

Previously we were passing only the names, but it is conceivable that
types might be useful too.

Make the info object hashable in order to use it with the @cache
decorator.

8 weeks agofix)composite): rename make_instance to make_object
Daniele Varrazzo [Sun, 30 Nov 2025 21:33:36 +0000 (22:33 +0100)] 
fix)composite): rename make_instance to make_object

The name feels more idiomatic.

Also clean up the related documentation.

8 weeks agochore: bump Mypy min required version to 1.19
Daniele Varrazzo [Mon, 1 Dec 2025 01:10:55 +0000 (02:10 +0100)] 
chore: bump Mypy min required version to 1.19

Avoid installing Mypy as part of the tests extra: installation fails
because a binary librt is not available. As a consequence, avoid running
Mypy-based tests in test CI jobs on PyPy.

2 months agodocs: 3.3 release notes cleanup and other small fixes
Daniele Varrazzo [Sat, 29 Nov 2025 18:45:50 +0000 (19:45 +0100)] 
docs: 3.3 release notes cleanup and other small fixes

2 months agotest: add free-threading-specific tests
Lysandros Nikolaou [Fri, 28 Nov 2025 01:12:43 +0000 (02:12 +0100)] 
test: add free-threading-specific tests

Add specific concurrency tests for the public interface of connections and
cursors

PR #1211, related to free-threading support (#1095).

2 months agoMerge pull request #1220 from dvarrazzo/feat/add-as-string
Daniele Varrazzo [Thu, 27 Nov 2025 18:14:58 +0000 (19:14 +0100)] 
Merge pull request #1220 from dvarrazzo/feat/add-as-string

Add sql.as_string() and as_bytes() function

2 months agodocs: drop cautionary warnings about t-strings
Daniele Varrazzo [Thu, 27 Nov 2025 01:47:14 +0000 (02:47 +0100)] 
docs: drop cautionary warnings about t-strings

2 months agodocs: add documentation for sql.as_string() and as_bytes() functions 1220/head
Daniele Varrazzo [Thu, 27 Nov 2025 01:49:09 +0000 (02:49 +0100)] 
docs: add documentation for sql.as_string() and as_bytes() functions

2 months agofix(c): make sure to return bytes from `Literal.as_bytes()`
Daniele Varrazzo [Thu, 27 Nov 2025 01:02:22 +0000 (02:02 +0100)] 
fix(c): make sure to return bytes from `Literal.as_bytes()`

In some case it might have returned a bytearray or a memoryview,
according to the dumper involved.

2 months agofeat: allow sql.as_string() and as_bytes() to convert values as literals
Daniele Varrazzo [Thu, 27 Nov 2025 01:44:54 +0000 (02:44 +0100)] 
feat: allow sql.as_string() and as_bytes() to convert values as literals

2 months agofeat: add sql.as_string(), sql.as_bytes() functions
Daniele Varrazzo [Wed, 26 Nov 2025 19:21:58 +0000 (20:21 +0100)] 
feat: add sql.as_string(), sql.as_bytes() functions

The functions are exported by the psycopg.sql module but are primarily
useful for template strings support, to allow building SQL queries
dynamically using t-strings.

2 months agoMerge pull request #1215 from dvarrazzo/pool-drain
Daniele Varrazzo [Mon, 24 Nov 2025 22:03:01 +0000 (23:03 +0100)] 
Merge pull request #1215 from dvarrazzo/pool-drain

Add ConnectionPool.drain() method

2 months agofeat(pool): add `drain()` method 1215/head
Daniele Varrazzo [Fri, 11 Jul 2025 20:02:11 +0000 (22:02 +0200)] 
feat(pool): add `drain()` method

Add the creation timestamp to the connection to verify that it should be
immediately discarded on return.

2 months agoMerge pull request #1219 from dvarrazzo/fix/copy-both
Daniele Varrazzo [Mon, 24 Nov 2025 18:35:05 +0000 (19:35 +0100)] 
Merge pull request #1219 from dvarrazzo/fix/copy-both

Don't fail on commands rturning COPY_BOTH results

2 months agofix: don't throw errors on COPY_BOTH results 1219/head
Daniele Varrazzo [Mon, 24 Nov 2025 14:27:51 +0000 (15:27 +0100)] 
fix: don't throw errors on COPY_BOTH results

This change only allows to execute a `START_REPLICATION` command on a
suitable configured database, i.e. the following commands would work:

    conn = psycopg.connect(DSN, replication="database", autocommit=True)
    conn.execute(
        """
        START_REPLICATION SLOT "my_replication_slot"
        LOGICAL 0/0 (proto_version '1',publication_names 'my_publication')
        """)
    <psycopg.Cursor [COPY_BOTH] [ACTIVE] at 0x...>

instead of gettgin an error such as  "COPY cannot be used with this method".

Please check https://github.com/psycopg/psycopg/issues/71#issuecomment-3393722855
for the description of the db configuration required to make this command work.

No further support for logical replication is planned at this moment, but this
change allows to play with replication without needing to go down at libpq
level to execute replication commands.

2 months agoMerge pull request #1218 from dvarrazzo/feat/update-loaders
Daniele Varrazzo [Mon, 24 Nov 2025 18:34:14 +0000 (19:34 +0100)] 
Merge pull request #1218 from dvarrazzo/feat/update-loaders

Allow to change loaders in results already returned

2 months agofeat: allow to change loaders in results already returned 1218/head
Daniele Varrazzo [Sun, 23 Nov 2025 23:49:05 +0000 (00:49 +0100)] 
feat: allow to change loaders in results already returned

Close #884

2 months agoMerge pull request #1184 from immortalcodes/feat-store-state-in-transaction
Daniele Varrazzo [Sat, 22 Nov 2025 22:37:54 +0000 (23:37 +0100)] 
Merge pull request #1184 from immortalcodes/feat-store-state-in-transaction

Added transaction attribute to record rollback/commit

2 months agodocs: improvements to Transaction.status documentation 1184/head
Daniele Varrazzo [Sat, 22 Nov 2025 17:49:57 +0000 (18:49 +0100)] 
docs: improvements to Transaction.status documentation

2 months agofix: make Transaction.Status a string enum
Daniele Varrazzo [Sat, 22 Nov 2025 18:09:44 +0000 (19:09 +0100)] 
fix: make Transaction.Status a string enum

2 months agodocs: add documentation for Transaction status
immortalcodes [Sun, 19 Oct 2025 10:55:09 +0000 (16:25 +0530)] 
docs: add documentation for Transaction status

2 months agorefactor: remove enter/exit attributes from transaction
immortalcodes [Wed, 22 Oct 2025 18:27:47 +0000 (23:57 +0530)] 
refactor: remove enter/exit attributes from transaction

2 months agofeat: add Transaction attribute to record the transaction state
immortalcodes [Tue, 14 Oct 2025 12:41:57 +0000 (18:11 +0530)] 
feat: add Transaction attribute to record the transaction state

2 months agoMerge pull request #1177 from adityatoshniwal/master
Daniele Varrazzo [Sat, 22 Nov 2025 18:12:32 +0000 (19:12 +0100)] 
Merge pull request #1177 from adityatoshniwal/master

feat: add support for setting cursor result set position

2 months agofix: improve set_result() proposal: 1177/head
Daniele Varrazzo [Sat, 22 Nov 2025 17:06:08 +0000 (18:06 +0100)] 
fix: improve set_result() proposal:

- make it async on async cursors (consistently with `results()`,
  inconsistently with `nextset()`, but the latter being sync on async
  cursors was a design mistake);
- raise IndexError, consistently with sequences, better error message;
- fix test, which were simply broken and the OP didn't bother to fix
  them;
- documentation improved.

2 months agofeat: add support for setting cursor result set position for multi-result queries
Aditya Toshniwal [Mon, 6 Oct 2025 08:58:56 +0000 (14:28 +0530)] 
feat: add support for setting cursor result set position for multi-result queries

2 months agoci: add Python 3.14 tests on macOS, Windows
Daniele Varrazzo [Fri, 21 Nov 2025 22:00:10 +0000 (23:00 +0100)] 
ci: add Python 3.14 tests on macOS, Windows

2 months agochore: bump psycopg_pool package version to 3.2.8
Daniele Varrazzo [Fri, 21 Nov 2025 16:44:20 +0000 (17:44 +0100)] 
chore: bump psycopg_pool package version to 3.2.8

2 months agochore: bump psycopg package version to 3.2.13
Daniele Varrazzo [Fri, 21 Nov 2025 16:41:07 +0000 (17:41 +0100)] 
chore: bump psycopg package version to 3.2.13

2 months agoMerge branch 'fix/pool-check-cancel-master'
Daniele Varrazzo [Fri, 21 Nov 2025 16:22:16 +0000 (17:22 +0100)] 
Merge branch 'fix/pool-check-cancel-master'

2 months agofix(pool): trap CancelledError more consistently in the pool codebase
Daniele Varrazzo [Fri, 21 Nov 2025 10:36:39 +0000 (11:36 +0100)] 
fix(pool): trap CancelledError more consistently in the pool codebase

Include also places that were left out such as the rollback and the task
scheduling.

Note that we are relaxing the exception handler we had set up to fix the
problem with cancelled clients on wait (#509): we only had to trap
CancelledError additionally but we started managing the whole
BaseException. I don't think that trapping KeyboardException or
SystemExit without re-raising is a good idea (I think that, for
robustness, we should, but then things become very verbose and not
necessarily correct).

2 months agofix(pool): manage CancelledError in some exception handling path
Daniele Varrazzo [Wed, 19 Nov 2025 23:51:43 +0000 (00:51 +0100)] 
fix(pool): manage CancelledError in some exception handling path

If a CancelledError was raised during check the connection would have
been lost. The exception would have bubbled up but likely users are
using some framework swallowing it because nobody reporting the "lost
connections" issue actually reported the CancelledError.

Close #1123
Close #1208

2 months agorefactor(pool): add _close_connection() method
Daniele Varrazzo [Wed, 19 Nov 2025 23:13:11 +0000 (00:13 +0100)] 
refactor(pool): add _close_connection() method

Improves on the solution for #1124

2 months agodocs: fix released version in news entry
Daniele Varrazzo [Fri, 21 Nov 2025 15:47:34 +0000 (16:47 +0100)] 
docs: fix released version in news entry

2 months agoci: only run docs workflow on the main repo
Daniele Varrazzo [Sun, 16 Nov 2025 16:49:46 +0000 (17:49 +0100)] 
ci: only run docs workflow on the main repo

https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-only-run-job-for-specific-repository

2 months agoMerge pull request #1207 from deeshantk/fix/improve-dns-error-message
Daniele Varrazzo [Sun, 16 Nov 2025 16:42:15 +0000 (17:42 +0100)] 
Merge pull request #1207 from deeshantk/fix/improve-dns-error-message

Fix/improve dns error message

2 months agodocs: mention more informative hostname resolution error message in news 1207/head
Daniele Varrazzo [Sun, 16 Nov 2025 15:18:43 +0000 (16:18 +0100)] 
docs: mention more informative hostname resolution error message in news

2 months agotest: test that the host is in the error message on name resolution error
Daniele Varrazzo [Sun, 16 Nov 2025 15:17:46 +0000 (16:17 +0100)] 
test: test that the host is in the error message on name resolution error

2 months agofix(conninfo): improve error message when host resolution fails
deeshantk [Sat, 8 Nov 2025 15:52:45 +0000 (21:22 +0530)] 
fix(conninfo): improve error message when host resolution fails

2 months agoMerge pull request #1210
Daniele Varrazzo [Sun, 16 Nov 2025 14:55:36 +0000 (15:55 +0100)] 
Merge pull request #1210

Fix copy concurrency

2 months agofix; keep the lock for the entire duration of copy 1210/head
Kamil Monicz [Fri, 14 Nov 2025 05:09:07 +0000 (06:09 +0100)] 
fix; keep the lock for the entire duration of copy

Avoid errors in concurrent operations on the same connection, from
different cursors.

Close #1210

Fix AsyncCursor.copy concurrency

Apply linter diff

Add test_copy_concurrency and update news

Update docs/news.rst

Co-authored-by: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Update tests/test_copy_async.py

Co-authored-by: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Update tests/test_copy_async.py

Co-authored-by: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Update tests/test_copy_async.py

Co-authored-by: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Simplify execution_log assertion

Revert unnecessary imports

2 months agochore(deps): bump the actions group with 2 updates
dependabot[bot] [Fri, 7 Nov 2025 11:50:14 +0000 (11:50 +0000)] 
chore(deps): bump the actions group with 2 updates

Bumps the actions group with 2 updates: [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) and [actions/upload-artifact](https://github.com/actions/upload-artifact).

Updates `pypa/cibuildwheel` from 3.2.0 to 3.2.1
- [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.2.0...v3.2.1)

Updates `actions/upload-artifact` from 4 to 5
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months agoMerge pull request #1202 from dvarrazzo/feat/customize-composite-dumper
Daniele Varrazzo [Fri, 7 Nov 2025 11:24:36 +0000 (12:24 +0100)] 
Merge pull request #1202 from dvarrazzo/feat/customize-composite-dumper

Customize composite dumper

2 months agodocs: add generic object to composite adaptation docs 1202/head
Daniele Varrazzo [Fri, 7 Nov 2025 02:37:56 +0000 (03:37 +0100)] 
docs: add generic object to composite adaptation docs

2 months agofeat: add make_sequence parameter to register_dumper
Daniele Varrazzo [Mon, 3 Nov 2025 13:23:57 +0000 (13:23 +0000)] 
feat: add make_sequence parameter to register_dumper

Allow to customize the way to extract a sequence from an object to dump
it as composite type.

2 months agorefactor(composite) mark private classes with leading underscore
Daniele Varrazzo [Thu, 30 Oct 2025 14:54:45 +0000 (14:54 +0000)] 
refactor(composite) mark private classes with leading underscore

2 months agofix(c): fix error revealed by Cython 3.2
Daniele Varrazzo [Fri, 7 Nov 2025 04:08:01 +0000 (05:08 +0100)] 
fix(c): fix error revealed by Cython 3.2

The error was likely introduced in cec696609b334aa32f871bd342e39b431fc799db
but the Cython compiler didn't flag it as error.

2 months agoMerge pull request #932 from seandstewart/sean/composite-keword-args
Daniele Varrazzo [Mon, 3 Nov 2025 13:19:17 +0000 (14:19 +0100)] 
Merge pull request #932 from seandstewart/sean/composite-keword-args

Support loading composite types with keyword arguments

3 months agodocs: add docs for register_composite's make_instance param 932/head
Daniele Varrazzo [Thu, 30 Oct 2025 14:39:19 +0000 (14:39 +0000)] 
docs: add docs for register_composite's make_instance param

3 months agorefactor: use make_instance instead of use_keywords
Daniele Varrazzo [Mon, 27 Oct 2025 01:14:35 +0000 (01:14 +0000)] 
refactor: use make_instance instead of use_keywords

This model is more similar to psycopg2 and allow more freedom to define
how to return a class. There could be a mix of positional and keyword
arguments for example.

3 months agofeat: support loading composite types with keyword arguments
Sean Stewart [Tue, 15 Oct 2024 21:50:51 +0000 (17:50 -0400)] 
feat: support loading composite types with keyword arguments

Changes:

1. Add `KeywordComposite*` classes to support loading composite types with keyword arguments.
2. Some optimizations for the `*BinaryLoader`.
    - Use a generator to unpack (oid, value) pairs.
    - Use a membership check instead of `KeyError` to optimize hot loops when looking up transformers.
3. Generics for the `*InstanceLoader` so mypy can better-track output results.

---

Co-authored by Daniele Varrazzo, mostly rebasing the feature on the
refactoring happening in the composite loading in #1175 and applying
some suggested PR changes.

3 months agorefactor: cleaner inheritance in record/composite loaders
Daniele Varrazzo [Mon, 6 Oct 2025 18:17:23 +0000 (20:17 +0200)] 
refactor: cleaner inheritance in record/composite loaders

- Avoid a common base class to reuse the code, use module-level
  functions.
- Make the inheritance lines of text and binary loaders similar.
- Add documentation and notes.

This refactoring is in preparation of the implementation of these
loaders in C, to clarify and simplify things. See #1175.

3 months agoMerge pull request #1167 from dsuhinin/dmitriy/change-connection-pool-creds
Daniele Varrazzo [Thu, 30 Oct 2025 13:20:12 +0000 (13:20 +0000)] 
Merge pull request #1167 from dsuhinin/dmitriy/change-connection-pool-creds

Introduce a way to update connection pool credentials

3 months agodocs(pool): add API documentation for conninfo/kwargs as callable 1167/head
Daniele Varrazzo [Tue, 28 Oct 2025 02:00:06 +0000 (02:00 +0000)] 
docs(pool): add API documentation for conninfo/kwargs as callable

3 months agofeat(pool): allow conninfo/kwargs to be callable
dsuhinin [Wed, 10 Sep 2025 15:08:04 +0000 (17:08 +0200)] 
feat(pool): allow conninfo/kwargs to be callable

Allow to change connection pool credentials dynamically without
requiring pool re-creation.

3 months agoMerge pull request #1196 from dvarrazzo/refactor/fast-sequence
Daniele Varrazzo [Thu, 30 Oct 2025 13:18:27 +0000 (13:18 +0000)] 
Merge pull request #1196 from dvarrazzo/refactor/fast-sequence

Refactor C API to use PyObject_Fast* functions

3 months agorefactor: look up for the oid for None only if None is actually dumped 1196/head
Daniele Varrazzo [Tue, 28 Oct 2025 10:44:14 +0000 (10:44 +0000)] 
refactor: look up for the oid for None only if None is actually dumped

3 months agoperf: use PySequence_Fast function instead of slower alternatives
Daniele Varrazzo [Mon, 27 Oct 2025 16:27:10 +0000 (16:27 +0000)] 
perf: use PySequence_Fast function instead of slower alternatives

3 months agofix(c): allow set_loader_types to be any sequence
Daniele Varrazzo [Mon, 27 Oct 2025 15:16:29 +0000 (15:16 +0000)] 
fix(c): allow set_loader_types to be any sequence

3 months agoMerge pull request #1199 from dvarrazzo/cython-lint
Daniele Varrazzo [Thu, 30 Oct 2025 12:28:38 +0000 (12:28 +0000)] 
Merge pull request #1199 from dvarrazzo/cython-lint

Add cython code linting

3 months agochore: add cython-lint to pre-commit hooks 1199/head
Daniele Varrazzo [Thu, 30 Oct 2025 01:53:44 +0000 (01:53 +0000)] 
chore: add cython-lint to pre-commit hooks

3 months agostyle: clean up cython code with a pass of cython-lint
Daniele Varrazzo [Thu, 30 Oct 2025 01:48:47 +0000 (01:48 +0000)] 
style: clean up cython code with a pass of cython-lint

3 months agoperf: use a C var for comparison instead of a Python var
Daniele Varrazzo [Thu, 30 Oct 2025 01:49:08 +0000 (01:49 +0000)] 
perf: use a C var for comparison instead of a Python var

3 months agochore: remove unneeded type-ignore comment
Daniele Varrazzo [Thu, 30 Oct 2025 02:05:23 +0000 (02:05 +0000)] 
chore: remove unneeded type-ignore comment

Problem solved with Cython 3.1.6 apparently.

3 months agoMerge pull request #1197 from mliezun/riscv64-support
Daniele Varrazzo [Thu, 30 Oct 2025 10:33:03 +0000 (10:33 +0000)] 
Merge pull request #1197 from mliezun/riscv64-support

Add riscv64 support for linux builds

3 months agoci: extend CI configuration to include riscv64 architecture support on libpq 1197/head
Miguel Liezun [Tue, 28 Oct 2025 12:31:43 +0000 (13:31 +0100)] 
ci: extend CI configuration to include riscv64 architecture support on libpq

3 months agoci: update CI configuration to support riscv64 architecture and Rocky Linux
Miguel Liezun [Tue, 28 Oct 2025 12:27:00 +0000 (13:27 +0100)] 
ci: update CI configuration to support riscv64 architecture and Rocky Linux

3 months 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.

3 months agotest(pool): consider another test flakey
Daniele Varrazzo [Wed, 29 Oct 2025 23:07:19 +0000 (23:07 +0000)] 
test(pool): consider another test flakey

3 months agotest(pool): consider test flakey
Daniele Varrazzo [Wed, 29 Oct 2025 23:03:22 +0000 (23:03 +0000)] 
test(pool): consider test flakey

It fails regularly in CI on Windows

3 months agodocs: add install differences grid
Daniele Varrazzo [Wed, 29 Oct 2025 22:53:42 +0000 (22:53 +0000)] 
docs: add install differences grid

3 months agochore: bump psycopg_pool package version to 3.2.7
Daniele Varrazzo [Sat, 25 Oct 2025 10:20:35 +0000 (11:20 +0100)] 
chore: bump psycopg_pool package version to 3.2.7

3 months agochore: bump psycopg package version to 3.2.12
Daniele Varrazzo [Sat, 25 Oct 2025 10:19:53 +0000 (11:19 +0100)] 
chore: bump psycopg package version to 3.2.12

3 months agoMerge pull request #1193 from jerch/fix/no-pinning-copy-text
Daniele Varrazzo [Sat, 25 Oct 2025 10:12:00 +0000 (11:12 +0100)] 
Merge pull request #1193 from jerch/fix/no-pinning-copy-text

3 months agodocs: add note about fixing the copy pinning issue 1193/head
Daniele Varrazzo [Fri, 24 Oct 2025 14:52:49 +0000 (15:52 +0100)] 
docs: add note about fixing the copy pinning issue

3 months 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

3 months 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