]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
15 months agorefactor: rename wait functions 'timeout' parameter to 'interval' 766/head
Daniele Varrazzo [Fri, 26 Jan 2024 11:49:23 +0000 (11:49 +0000)] 
refactor: rename wait functions 'timeout' parameter to 'interval'

15 months agorefactor: handle timeout in the connection generator, not the waiting function
Daniele Varrazzo [Fri, 26 Jan 2024 09:47:31 +0000 (09:47 +0000)] 
refactor: handle timeout in the connection generator, not the waiting function

The waiting function is supposed to be generic, the timeout is a policy
decision of the generator.

This change aligns the semantics of the `timeout` parameter of `wait_conn()`
to the one of the other wait functions: the timeout is actually an
interval. It will be renamed to clarify that in a followup commit.

15 months agostyle: use literals instead of the concatenation operator for long strings
Daniele Varrazzo [Thu, 4 Apr 2024 21:37:57 +0000 (21:37 +0000)] 
style: use literals instead of the concatenation operator for long strings

The reason we were using operators was to stop async_to_sync to generate
a line too long and incur in the flake8 ires.

MR #764 suggests to disable line length check altogether, but we can use
per-file ignore, as there will not be many cases to manage.

15 months agodocs: add a note to remember why flake8 configuration is repeated
Daniele Varrazzo [Thu, 4 Apr 2024 21:37:10 +0000 (21:37 +0000)] 
docs: add a note to remember why flake8 configuration is repeated

15 months agochore: regenerate _pq_ctypes.pyi
Denis Laxalde [Fri, 5 Apr 2024 10:35:53 +0000 (12:35 +0200)] 
chore: regenerate _pq_ctypes.pyi

Following commit a7f280227923ccb5de8928f7335e092531eedea1.

15 months agoMerge branch 'mypy-love'
Daniele Varrazzo [Fri, 5 Apr 2024 09:20:24 +0000 (09:20 +0000)] 
Merge branch 'mypy-love'

15 months agorefactor(c): mor compact guard for unsupported libpq versions 768/head
Daniele Varrazzo [Thu, 4 Apr 2024 23:20:12 +0000 (23:20 +0000)] 
refactor(c): mor compact guard for unsupported libpq versions

15 months agorefactor: less verbose pattern to manage optional libpq functions
Daniele Varrazzo [Thu, 4 Apr 2024 23:03:11 +0000 (23:03 +0000)] 
refactor: less verbose pattern to manage optional libpq functions

15 months agolint: avoid mypy warning in _pq_ctypes.py
Daniele Varrazzo [Thu, 4 Apr 2024 22:23:23 +0000 (22:23 +0000)] 
lint: avoid mypy warning in _pq_ctypes.py

I can't find how my editor is set up, but it doesn't complain on this
file, and yet calling mypy on this file only will find several error.

Having seen @dlax adding `type: ignore[no-any-return]` comments makes me
want to fix this.

15 months agodocs: let the 'pq' role possibly link to "devel" PostgreSQL docs
Denis Laxalde [Tue, 2 Apr 2024 09:35:23 +0000 (11:35 +0200)] 
docs: let the 'pq' role possibly link to "devel" PostgreSQL docs

If we now set libpq_docs_version to 'devel', the pq Sphinx role will use
the master branch when looking libpq.sgml and the 'devel' URL component
when linking to libpq online documentation.

15 months agofix: more careful stripping of error prefixes
Daniele Varrazzo [Sun, 31 Mar 2024 20:57:42 +0000 (20:57 +0000)] 
fix: more careful stripping of error prefixes

Only strip the known prefixes, both in English and in the currently
known localizations.

Added script to generate regexp to match every backend localization. The
script was executed on PostgreSQL commit f4ad0021af (on master branch,
before v17).

Close #752.

15 months agoMerge pull request #744 from dlax/async-to-sync-jobs
Daniele Varrazzo [Mon, 1 Apr 2024 23:03:10 +0000 (00:03 +0100)] 
Merge pull request #744 from dlax/async-to-sync-jobs

feat(tools): possibly run async_to_sync.py concurrently

15 months agofeat(tools): check last modification times in async_to_sync.py 744/head
Denis Laxalde [Mon, 4 Mar 2024 07:37:58 +0000 (08:37 +0100)] 
feat(tools): check last modification times in async_to_sync.py

We now only process _async.py files with a modification time higher than
their sync counterpart. A -B,--convert-all option is added to force
conversion of all (specified) input files and skip last-modification
time check.

15 months agofeat(tools): add a -L,--log-level option to async_to_sync.py
Denis Laxalde [Mon, 4 Mar 2024 07:27:14 +0000 (08:27 +0100)] 
feat(tools): add a -L,--log-level option to async_to_sync.py

We'll use DEBUG messages in the next commit.

15 months agofeat(tools): run async_to_sync.py concurrently
Denis Laxalde [Fri, 1 Mar 2024 13:21:35 +0000 (14:21 +0100)] 
feat(tools): run async_to_sync.py concurrently

Multi-processing is used by default (using all available processors),
but can be disabled or limited with the -j/--jobs option.

15 months agotest: add pool package to django tests
Daniele Varrazzo [Sun, 31 Mar 2024 22:22:07 +0000 (22:22 +0000)] 
test: add pool package to django tests

It seems needed in the current main branch.

15 months agodocs: fix a typo in FinishedPGconn docstring
Denis Laxalde [Fri, 8 Mar 2024 10:00:34 +0000 (11:00 +0100)] 
docs: fix a typo in FinishedPGconn docstring

16 months agodocs: fix missing `async` in example
Daniele Varrazzo [Mon, 26 Feb 2024 10:52:21 +0000 (11:52 +0100)] 
docs: fix missing `async` in example

Close #740.

16 months agodocs(pool): reorder sections in a way that makes more sense 738/head
Daniele Varrazzo [Sun, 18 Feb 2024 00:04:34 +0000 (01:04 +0100)] 
docs(pool): reorder sections in a way that makes more sense

16 months agodocs(pool): add box warning against opening async pools on init
Daniele Varrazzo [Sun, 18 Feb 2024 00:03:20 +0000 (01:03 +0100)] 
docs(pool): add box warning against opening async pools on init

16 months agofix(pool): make opening an async connection pool in the constructor a runtime warning
Daniele Varrazzo [Fri, 16 Feb 2024 13:02:17 +0000 (14:02 +0100)] 
fix(pool): make opening an async connection pool in the constructor a runtime warning

Deprecation warnings are ignored by default and easy to miss.

Close #737.

16 months agoci: skip refcount tests on scheduled jobs
Daniele Varrazzo [Tue, 13 Feb 2024 10:45:27 +0000 (11:45 +0100)] 
ci: skip refcount tests on scheduled jobs

17 months agofix: avoid to create reference loops in datetime adapters
Daniele Varrazzo [Wed, 7 Feb 2024 01:16:06 +0000 (01:16 +0000)] 
fix: avoid to create reference loops in datetime adapters

Setting the reference to a bound method in the state creates a reference
loop.

The issue is minimal because the gc will be able to break these loops
anyway and because it mostly happens with exotic or unsupported
date/interval styles.

17 months agodocs: fix typo in release notes
Daniele Varrazzo [Mon, 5 Feb 2024 16:34:36 +0000 (16:34 +0000)] 
docs: fix typo in release notes

17 months agochore: bump psycopg package version to 3.1.18
Daniele Varrazzo [Sun, 4 Feb 2024 17:42:54 +0000 (17:42 +0000)] 
chore: bump psycopg package version to 3.1.18

17 months agofix(c): drop spurious loop break in pipeline_communicate
Daniele Varrazzo [Fri, 4 Nov 2022 22:17:13 +0000 (23:17 +0100)] 
fix(c): drop spurious loop break in pipeline_communicate

This makes the Python and the C implementation more similar. The
difference was unexpected but apparently harmless. See #431

17 months agotests: don't depend on ConnDict
Daniele Varrazzo [Sun, 4 Feb 2024 12:07:24 +0000 (12:07 +0000)] 
tests: don't depend on ConnDict

Added in 3.2, so can't run the pool tests using Psycopg 3.1

17 months agochore: bump checkout action to v4
Daniele Varrazzo [Sun, 4 Feb 2024 12:00:47 +0000 (12:00 +0000)] 
chore: bump checkout action to v4

17 months agochore: bump cibuildwheel version
Daniele Varrazzo [Sun, 4 Feb 2024 12:14:46 +0000 (12:14 +0000)] 
chore: bump cibuildwheel version

It should fix an error building Windows wheel
https://github.com/pypa/cibuildwheel/issues/1740

17 months agoMerge pull request #724
Daniele Varrazzo [Thu, 1 Feb 2024 19:13:21 +0000 (19:13 +0000)] 
Merge pull request #724

17 months agoparent 4ccc131669ff4d5e67b7a93cbd7c7c413a172411 724/head
Martin Baláž [Fri, 26 Jan 2024 12:41:52 +0000 (13:41 +0100)] 
parent 4ccc131669ff4d5e67b7a93cbd7c7c413a172411
author Martin Baláž <embeembe@gmail.com> 1706272912 +0100
committer Daniele Varrazzo <daniele.varrazzo@gmail.com> 1706783634 +0000

feat: add `scalar_row` factory

Close #723

17 months agofix: fix wait_async with timeout 0
Daniele Varrazzo [Tue, 30 Jan 2024 02:29:05 +0000 (02:29 +0000)] 
fix: fix wait_async with timeout 0

17 months agoRevert "Merge branch 'conn-generator-refactoring'"
Daniele Varrazzo [Mon, 29 Jan 2024 15:40:28 +0000 (15:40 +0000)] 
Revert "Merge branch 'conn-generator-refactoring'"

This reverts commit 70790e3f19a13c025f1abebeb0c64cb13cf26c8f, reversing
changes made to c25b8409221d05d371c51eceebef6970eb33ffa0.

17 months agoMerge branch 'conn-generator-refactoring'
Daniele Varrazzo [Mon, 29 Jan 2024 02:26:46 +0000 (02:26 +0000)] 
Merge branch 'conn-generator-refactoring'

17 months agorefactor: rename wait functions 'timeout' parameter to 'interval'
Daniele Varrazzo [Fri, 26 Jan 2024 11:49:23 +0000 (11:49 +0000)] 
refactor: rename wait functions 'timeout' parameter to 'interval'

17 months agorefactor: handle timeout in the connection generator, not the waiting function
Daniele Varrazzo [Fri, 26 Jan 2024 09:47:31 +0000 (09:47 +0000)] 
refactor: handle timeout in the connection generator, not the waiting function

The waiting function is supposed to be generic, the timeout is a policy
decision of the generator.

This change aligns the semantics of the `timeout` parameter of `wait_conn()`
to the one of the other wait functions: the timeout is actually an
interval. It will be renamed to clarify that in a followup commit.

17 months agoMerge branch 'interruptable-notify'
Daniele Varrazzo [Mon, 29 Jan 2024 02:26:11 +0000 (02:26 +0000)] 
Merge branch 'interruptable-notify'

17 months agodocs: add docs about timeout and stop_after notification parameters
Daniele Varrazzo [Sat, 27 Jan 2024 02:51:20 +0000 (02:51 +0000)] 
docs: add docs about timeout and stop_after notification parameters

17 months agofeat: add `timeout` and `stop_after` parameters to Connection.notifies
Daniele Varrazzo [Tue, 24 Oct 2023 21:51:17 +0000 (23:51 +0200)] 
feat: add `timeout` and `stop_after` parameters to Connection.notifies

Close #340

17 months agofix: only cancel query on interrupt if the connection is in active state
Daniele Varrazzo [Wed, 24 Jan 2024 19:03:24 +0000 (19:03 +0000)] 
fix: only cancel query on interrupt if the connection is in active state

17 months agofix: include timeout as part of the generators/wait conversation
Daniele Varrazzo [Wed, 24 Jan 2024 19:51:30 +0000 (19:51 +0000)] 
fix: include timeout as part of the generators/wait conversation

So far, the wait functions would have shielded the generators from a
wait timeout. However this behaviour makes impossible to make a
generator interruptible.

Note that the `wait_c` generator was interruptible, but probably it
wasn't doing the right thing. In the `poll` branch, I understand that
the returned ready value, in case of timeout, would have been the same
of the input wait value, because of the input/output nature of the
pollfd struct; I haven't analyzed more deeply the select() case.

17 months agodocs: fix tickets format
Daniele Varrazzo [Mon, 29 Jan 2024 02:23:28 +0000 (02:23 +0000)] 
docs: fix tickets format

17 months agoMerge pull request #725 from mgorny/musl-ctypes
Daniele Varrazzo [Mon, 29 Jan 2024 02:22:20 +0000 (02:22 +0000)] 
Merge pull request #725 from mgorny/musl-ctypes

17 months agodocs: mention musl-ctypes workaround in news file 725/head
Daniele Varrazzo [Mon, 29 Jan 2024 00:24:05 +0000 (00:24 +0000)] 
docs: mention musl-ctypes workaround in news file

17 months agofix: add `libc.so` fallback for musl systems to the ctypes impl
Michał Górny [Sat, 27 Jan 2024 14:28:34 +0000 (15:28 +0100)] 
fix: add `libc.so` fallback for musl systems to the ctypes impl

Add a fallback to `libc.so` library name to fix loading the ctypes
implementation on musl systems.  On musl, `find_library("c")` does
not work (the problem has been reported to CPython in 2014, and has not
been resolved yet), causing the module to fail on `assert libcname`.
Instead, add a fallback to using `libc.so` and let ctypes raise
an exception if such a library does not exist.

17 months agotest: drop ineffective marker on fixture
Daniele Varrazzo [Mon, 29 Jan 2024 00:08:47 +0000 (00:08 +0000)] 
test: drop ineffective marker on fixture

Previously ignored, it has become an error in PyTest 8.

17 months agoMerge branch 'no-conn-composible'
Daniele Varrazzo [Sat, 27 Jan 2024 02:57:18 +0000 (02:57 +0000)] 
Merge branch 'no-conn-composible'

17 months agofeat: allow no connection parameter in sql.Composible.as_string()/as_bytes()
Daniele Varrazzo [Fri, 19 Jan 2024 16:40:37 +0000 (17:40 +0100)] 
feat: allow no connection parameter in sql.Composible.as_string()/as_bytes()

Close #716

17 months agofeat: allow Identifier.as_string() and as_bytes() to take no connection
Daniele Varrazzo [Fri, 12 Jan 2024 16:57:42 +0000 (17:57 +0100)] 
feat: allow Identifier.as_string() and as_bytes() to take no connection

17 months agoMerge pull request #720 from enapupe/fix-interval-overflow
Daniele Varrazzo [Sat, 27 Jan 2024 02:05:24 +0000 (02:05 +0000)] 
Merge pull request #720 from enapupe/fix-interval-overflow

fix: use long for seconds to prevent IntervalLoader from overflowing

17 months agodocs: add release note about interval overflow fix 720/head
Daniele Varrazzo [Sat, 27 Jan 2024 01:29:32 +0000 (01:29 +0000)] 
docs: add release note about interval overflow fix

17 months agofix(c): don't overflow intervals on windows either
Daniele Varrazzo [Sat, 27 Jan 2024 01:09:11 +0000 (01:09 +0000)] 
fix(c): don't overflow intervals on windows either

In MSVC, long is 4 bytes. Should use long long instead. int64_t is more
understandable.

17 months agofix(c): use long for seconds to prevent IntervalLoader from overflowing
Iacami Gevaerd [Tue, 16 Jan 2024 15:13:01 +0000 (12:13 -0300)] 
fix(c): use long for seconds to prevent IntervalLoader from overflowing

if the given interval is too long for a regular int it will become
negative an cause inconsistencies with the regular python implementation

17 months agochore: bump black to 24.1.0
Daniele Varrazzo [Fri, 26 Jan 2024 23:44:49 +0000 (23:44 +0000)] 
chore: bump black to 24.1.0

17 months agoMerge branch 'fix-deadlock-on-pipeline-exit'
Daniele Varrazzo [Fri, 26 Jan 2024 23:53:24 +0000 (23:53 +0000)] 
Merge branch 'fix-deadlock-on-pipeline-exit'

17 months agofix: force a sync exiting the pipeline mode
Daniele Varrazzo [Fri, 26 Jan 2024 00:29:29 +0000 (00:29 +0000)] 
fix: force a sync exiting the pipeline mode

Without it there may be a deadlock and we would be waiting to fetch a
result that will never come.

Close #685.

18 months agofeat: add ConnDict, ConnParam to abc module
Daniele Varrazzo [Mon, 8 Jan 2024 12:22:55 +0000 (13:22 +0100)] 
feat: add ConnDict, ConnParam to abc module

Formalize the type of parameter to pass to the libq.

ConnMapping is required when a covariant type is needed.

18 months agorefactor: move TypeAlias back to _compat module
Daniele Varrazzo [Mon, 8 Jan 2024 11:48:22 +0000 (12:48 +0100)] 
refactor: move TypeAlias back to _compat module

It was imported directly by typing_extensions to work around
https://github.com/microsoft/pyright/issues/4197
but the issue has been fixed in pyright 1.1.297, released almost one
year ago.

18 months agochore: bump psycopg_pool package version to 3.2.1
Daniele Varrazzo [Sun, 7 Jan 2024 01:42:03 +0000 (02:42 +0100)] 
chore: bump psycopg_pool package version to 3.2.1

18 months agochore: bump psycopg package version to 3.1.17
Daniele Varrazzo [Sun, 7 Jan 2024 01:41:20 +0000 (02:41 +0100)] 
chore: bump psycopg package version to 3.1.17

18 months agoci: revert upload action to v3
Daniele Varrazzo [Sun, 7 Jan 2024 11:49:41 +0000 (12:49 +0100)] 
ci: revert upload action to v3

v4 requires to have every uploaded artifact in a separate directory.

- https://github.com/actions/upload-artifact/issues/478
- https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md

18 months agochore(c): add missing enum entries
Daniele Varrazzo [Sat, 6 Jan 2024 19:37:37 +0000 (20:37 +0100)] 
chore(c): add missing enum entries

18 months agodocs: add note about checking enums and docs on PostgreSQL update
Daniele Varrazzo [Sat, 6 Jan 2024 19:36:56 +0000 (20:36 +0100)] 
docs: add note about checking enums and docs on PostgreSQL update

18 months agoMerge branch 'fix-699-master'
Daniele Varrazzo [Sat, 6 Jan 2024 19:50:24 +0000 (20:50 +0100)] 
Merge branch 'fix-699-master'

18 months agorefactor: generate conninfo attempts from async counterpart
Daniele Varrazzo [Sat, 6 Jan 2024 17:06:54 +0000 (18:06 +0100)] 
refactor: generate conninfo attempts from async counterpart

18 months agofix: perform multiple attemps if a host name resolve to multiple hosts
Daniele Varrazzo [Sat, 6 Jan 2024 16:24:48 +0000 (17:24 +0100)] 
fix: perform multiple attemps if a host name resolve to multiple hosts

We now perform DNS resolution in Python both in the sync and async code.
Because the two code paths are now very similar, make sure they pass the
same tests.

Close #699.

18 months agorefactor(test): make resolution monkeypatching common fixtures
Daniele Varrazzo [Sat, 6 Jan 2024 16:10:58 +0000 (17:10 +0100)] 
refactor(test): make resolution monkeypatching common fixtures

18 months agorefactor: separate ConnectionInfo object from conninfo module
Daniele Varrazzo [Sat, 6 Jan 2024 14:50:14 +0000 (15:50 +0100)] 
refactor: separate ConnectionInfo object from conninfo module

It was there just because the name is similar, but its purpose is
entirely different.

18 months agostyle: drop unneeded function definition split
Daniele Varrazzo [Sat, 6 Jan 2024 12:50:05 +0000 (13:50 +0100)] 
style: drop unneeded function definition split

18 months agochore: upload github actions dependencies
Daniele Varrazzo [Tue, 2 Jan 2024 03:29:48 +0000 (04:29 +0100)] 
chore: upload github actions dependencies

18 months agoMerge branch 'fix-709'
Daniele Varrazzo [Sat, 6 Jan 2024 12:11:50 +0000 (13:11 +0100)] 
Merge branch 'fix-709'

18 months agorefactor(pool): rename ConnectionAttempt as AttemptWithBackoff
Daniele Varrazzo [Fri, 29 Dec 2023 23:49:28 +0000 (00:49 +0100)] 
refactor(pool): rename ConnectionAttempt as AttemptWithBackoff

This class implements the backoff + jitter policy and is now used to
repeat checks too.

18 months agofix(pool): use an exponential backoff to separate failing checks
Daniele Varrazzo [Fri, 29 Dec 2023 23:41:07 +0000 (00:41 +0100)] 
fix(pool): use an exponential backoff to separate failing checks

This is a consistent behaviour with with the exponential backoff used in
reconnection attempts, and actually we could reuse the same object
implementing the backoff + jitter.

See also #709

18 months agofix(pool): respect timeout on getconn() when the check function fails
Daniele Varrazzo [Fri, 29 Dec 2023 13:15:07 +0000 (14:15 +0100)] 
fix(pool): respect timeout on getconn() when the check function fails

Close #709.

18 months agoMerge branch 'fix-308'
Daniele Varrazzo [Sat, 6 Jan 2024 11:19:58 +0000 (12:19 +0100)] 
Merge branch 'fix-308'

18 months agorefactor(pool): avoid constructor overloading by using generic default
Daniele Varrazzo [Wed, 3 Jan 2024 01:32:28 +0000 (02:32 +0100)] 
refactor(pool): avoid constructor overloading by using generic default

18 months agorefactor: drop overloading of the Connection.connect() function
Daniele Varrazzo [Wed, 3 Jan 2024 01:14:46 +0000 (02:14 +0100)] 
refactor: drop overloading of the Connection.connect() function

The default for the Row TypeVar makes it redundant.

18 months agofix: define the Row TypeVar as defaulting to TupleRow
Daniele Varrazzo [Wed, 3 Jan 2024 00:44:22 +0000 (01:44 +0100)] 
fix: define the Row TypeVar as defaulting to TupleRow

This allows to return `Self` uniformly from the `Connection.connect()` class
method, which in turns allows to subclass the connection without the
need of redefining the complex signature.

Close #308

18 months agorefactor: use TypeVar from typing_extension
Daniele Varrazzo [Wed, 3 Jan 2024 00:33:35 +0000 (01:33 +0100)] 
refactor: use TypeVar from typing_extension

This includes the default parameter, which should fix the problem of the
awkward definition of Row defaulting to TupleRow.

18 months agorefactor: use Self to represent the return from `BaseConnection._connect_gen()`
Daniele Varrazzo [Wed, 3 Jan 2024 00:59:30 +0000 (01:59 +0100)] 
refactor: use Self to represent the return from `BaseConnection._connect_gen()`

18 months agochore: drop unneeded type annotations on self
Daniele Varrazzo [Wed, 3 Jan 2024 02:07:27 +0000 (03:07 +0100)] 
chore: drop unneeded type annotations on self

18 months agorefactor: use typing.Self
Daniele Varrazzo [Sat, 30 Dec 2023 00:30:39 +0000 (01:30 +0100)] 
refactor: use typing.Self

The object seems available for all the supported Python version and
should avoid problems with PyRight (see #708).

It is not a solution for #308 because we cannot use `Self[Row]`.

18 months agotest: add async driver to sqlalchemy pipeline
Federico Caselli [Mon, 18 Dec 2023 20:31:22 +0000 (21:31 +0100)] 
test: add async driver to sqlalchemy pipeline

18 months agochore: bump psycopg package version to 3.1.16
Daniele Varrazzo [Tue, 19 Dec 2023 01:07:54 +0000 (02:07 +0100)] 
chore: bump psycopg package version to 3.1.16

18 months agofix: fix empty ports handling in async multiple connection attempts
Daniele Varrazzo [Mon, 18 Dec 2023 23:58:35 +0000 (00:58 +0100)] 
fix: fix empty ports handling in async multiple connection attempts

Close #703.

18 months agochore: bump ast_commment version
Daniele Varrazzo [Mon, 18 Dec 2023 22:33:12 +0000 (23:33 +0100)] 
chore: bump ast_commment version

Drop workarounds for a couple of bugs which have been fixed upstream.

Force re-generation of the docker image when the ast_comment module changes.

18 months agodocs: improvement to the Cursor docs
Daniele Varrazzo [Mon, 18 Dec 2023 01:26:49 +0000 (02:26 +0100)] 
docs: improvement to the Cursor docs

18 months agodocs: add section about concurrency
Daniele Varrazzo [Mon, 18 Dec 2023 01:23:52 +0000 (02:23 +0100)] 
docs: add section about concurrency

18 months agochore: include codespell in dev dependencies
Daniele Varrazzo [Mon, 18 Dec 2023 01:54:26 +0000 (02:54 +0100)] 
chore: include codespell in dev dependencies

18 months agochore: bump psycopg package version to 3.1.15
Daniele Varrazzo [Thu, 14 Dec 2023 03:26:56 +0000 (04:26 +0100)] 
chore: bump psycopg package version to 3.1.15

18 months agoMerge branch 'fix-service-file'
Daniele Varrazzo [Thu, 14 Dec 2023 12:51:23 +0000 (13:51 +0100)] 
Merge branch 'fix-service-file'

18 months agorefactor: add compiled_default option to _get_params
Daniele Varrazzo [Wed, 13 Dec 2023 13:20:49 +0000 (14:20 +0100)] 
refactor: add compiled_default option to _get_params

Make it less awkward to come out with a 5432 when we really want a port
number (in name resolution) but still allow to leave it unspecified to
avoid mangling the conninfo.

18 months agofix: honour the PGLOADBALANCEHOSTS env var
Daniele Varrazzo [Wed, 13 Dec 2023 11:31:13 +0000 (12:31 +0100)] 
fix: honour the PGLOADBALANCEHOSTS env var

18 months agofix: honour the PGCONNECT_TIMEOUT env var
Daniele Varrazzo [Wed, 13 Dec 2023 03:55:51 +0000 (04:55 +0100)] 
fix: honour the PGCONNECT_TIMEOUT env var

18 months agofix: set minimum timeout to 2s
Daniele Varrazzo [Wed, 13 Dec 2023 03:35:48 +0000 (04:35 +0100)] 
fix: set minimum timeout to 2s

This is consistent with what the libpq does.

Move timeout calculation to a function in conninfo module and don't
change the connect_timeout parameter explicitly in the connection
string.

Drop awful drop_default_args_from_conninfo() from tests.

18 months agofix: add debug logging when a connection attempt is discarded
Daniele Varrazzo [Wed, 13 Dec 2023 03:34:40 +0000 (04:34 +0100)] 
fix: add debug logging when a connection attempt is discarded

18 months agorefactor: return lists from conninfo attempt functions
Daniele Varrazzo [Wed, 13 Dec 2023 00:33:04 +0000 (01:33 +0100)] 
refactor: return lists from conninfo attempt functions

18 months agofix: shuffle attempts when one host resolves to more than one IP
Daniele Varrazzo [Wed, 13 Dec 2023 00:03:55 +0000 (01:03 +0100)] 
fix: shuffle attempts when one host resolves to more than one IP

This behaviour (first resolve all the hosts, then shuffle the IPs) mimics
better what the libpq does in non-async mode.

18 months agofix: don't add defaults to connection strings
Daniele Varrazzo [Tue, 12 Dec 2023 19:33:20 +0000 (20:33 +0100)] 
fix: don't add defaults to connection strings

A default such as empty string for host may may shadow values defined in
a service file.

Fix #694.

19 months agofix: fix iteration resolving hosts with multiple IP addresses in async mode
Daniele Varrazzo [Tue, 12 Dec 2023 16:56:37 +0000 (17:56 +0100)] 
fix: fix iteration resolving hosts with multiple IP addresses in async mode

Fix #695 (not 100% sure, but probably).