]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
2 years agofix: don't clobber a Python exception on COPY FROM with QueryCanceled 609/head
Daniele Varrazzo [Fri, 21 Jul 2023 01:10:01 +0000 (02:10 +0100)] 
fix: don't clobber a Python exception on COPY FROM with QueryCanceled

We trigger the server to raise the QueryCanceled; however, the original
exception has more information (the traceback). We can consider the
server exception just a notification that cancellation worked as
expected.

This is a mild change in behaviour, as the fixed tests state. However,
raising QueryCanceled is not explicitly documented and not part of a
strict interface, so we can probably change the exception raised without
needing to wait for psycopg 4.

Close #593

2 years agochore: bump mypy to 1.4.1
Denis Laxalde [Wed, 12 Jul 2023 06:39:51 +0000 (08:39 +0200)] 
chore: bump mypy to 1.4.1

The issue previously mentioned about '# type: ignore[arg-type]' in
rows.py got resolved.

The new '# type: ignore[comparison-overlap]' in test_pipeline*.py are
due to https://github.com/python/mypy/issues/15509, a known regression
from Mypy 1.4. We use the workaround documented in the release blog post
https://mypy-lang.blogspot.com/2023/06/mypy-140-released.html (section
"Narrowing Enum Values Using “==”").

2 years agoops: fix broken build on Windows amd64
Daniele Varrazzo [Sun, 18 Jun 2023 17:18:09 +0000 (19:18 +0200)] 
ops: fix broken build on Windows amd64

2 years agoMark test_ctrl_c_handler as timing sensitive
Sandro [Tue, 13 Jun 2023 09:34:55 +0000 (11:34 +0200)] 
Mark test_ctrl_c_handler as timing sensitive

psycopg> =================================== FAILURES ===================================
psycopg> _____________________________ test_ctrl_c_handler ______________________________
psycopg>         t0 = time.time()
psycopg>         proc = sp.Popen([sys.executable, "-s", "-c", script], creationflags=creationflags)
psycopg>         proc.communicate()
psycopg>         t = time.time() - t0
psycopg>         assert proc.returncode == 0
psycopg> >       assert 1 < t < 2
psycopg> E       assert 3.7456982135772705 < 2
psycopg>
psycopg> tests/test_concurrency.py:293: AssertionError

2 years agoMerge branch 'fix-565-3.1' into maint-3.1
Daniele Varrazzo [Tue, 13 Jun 2023 14:03:52 +0000 (16:03 +0200)] 
Merge branch 'fix-565-3.1' into maint-3.1

2 years agofix: finish the PGconn upon connection failure
Denis Laxalde [Fri, 19 May 2023 07:06:55 +0000 (09:06 +0200)] 
fix: finish the PGconn upon connection failure

Attaching the non-finished PGconn to exceptions raised in connect() is
causing problem, as described in issue #565, because the PGconn might
not get finished soon enough in application code and the socket would
remain open.

On the other hand, just removing the pgconn attribute from Error would
be a breaking change and we'd loose the inspection features introduced
in commit 9220293dc023b757f2a57702c14b1460ff8f25b0.

As an alternative, we define a new PGconn implementation that is
error-specific: it captures all attributes of the original PGconn and
fails upon other operations (methods call). Some attributes have a
default value since they are not available in old PostgreSQL versions.

Finally, the (real) PGconn is finished before raising exception in
generators.connect().

2 years agochore: add a trailing comma in Error.__init__() to make black happy
Denis Laxalde [Fri, 19 May 2023 07:06:55 +0000 (09:06 +0200)] 
chore: add a trailing comma in Error.__init__() to make black happy

2 years agotests: check that OperationalError raised by connect() holds a pgconn
Denis Laxalde [Tue, 16 May 2023 11:28:37 +0000 (13:28 +0200)] 
tests: check that OperationalError raised by connect() holds a pgconn

Sort of a non-regression test for the part of commit
9220293dc023b757f2a57702c14b1460ff8f25b0 concerning generators. It used
roughly the same logic as tests/pq/test_pgconn.py::test_used_password()
to determine if the test connection needs a password and gets skipped
otherwise.

2 years agofix(pool): check connections' max_lifetime on ``check()``
Daniele Varrazzo [Thu, 8 Jun 2023 13:56:22 +0000 (15:56 +0200)] 
fix(pool): check connections' max_lifetime on ``check()``

Close #482

2 years agoMerge branch 'fix-585-3.1' into maint-3.1
Daniele Varrazzo [Mon, 12 Jun 2023 23:17:40 +0000 (01:17 +0200)] 
Merge branch 'fix-585-3.1' into maint-3.1

2 years agofix: always validate PrepareManager cache in pipeline mode
Denis Laxalde [Thu, 8 Jun 2023 09:21:42 +0000 (11:21 +0200)] 
fix: always validate PrepareManager cache in pipeline mode

Previously, when processing results in pipeline mode
(BasePipeline._process_results()), we'd run
'cursor._check_results(results)' early before calling
_prepared.validate() with prepared statement information. However, if
this check step fails, for example if the pipeline got aborted due to a
previous error, the latter step (PrepareManager cache validation) was
not run.

We fix this by reversing the logic, and checking results last.

However, this is not enough, because the results processing logic in
BasePipeline._fetch_gen() or _communicate_gen(), which sequentially
walked through fetched results, would typically stop at the first
exception and thus possibly never go through the step of validating
PrepareManager cache if a previous error happened.

We fix that by making sure that *all* results are processed, possibly
capturing the first exception and then re-raising it. In both
_communicate_gen() and _fetch_gen(), we no longer store results in the
'to_process' like, but process then upon reception as this logic is no
longer needed.

Fix #585.

2 years agodocs: adjust PrepareManager.validate() docstring
Denis Laxalde [Thu, 8 Jun 2023 12:03:18 +0000 (14:03 +0200)] 
docs: adjust PrepareManager.validate() docstring

From commit bfabe88aba4769e0a44206e1ace7c299991a957d, the method does
not return a command, but it records it through _rotate().

2 years agodocs: remove outdated comments in PrepareManager's docstrings
Denis Laxalde [Thu, 8 Jun 2023 11:38:44 +0000 (13:38 +0200)] 
docs: remove outdated comments in PrepareManager's docstrings

PrepareManager's methods maybe_add_to_cache() and validate() are said to
only be used in pipeline mode, but this is wrong as can be seen in
BaseCursor._maybe_prepare_gen(). (Comments are probably a left-over from
a prior implementation of the pipeline mode.)

2 years agofeat: allow binary JSON dumps
Lionel Panhaleux [Fri, 19 May 2023 12:03:29 +0000 (14:03 +0200)] 
feat: allow binary JSON dumps

Some JSON libraries, in particular the widespread
[orjson](https://github.com/ijl/orjson#quickstart) library, directly
dump data in binary format.

This change allows it and avoids having to decode/encode in these cases
by testing the return type of the `dumps` function.

2 years agoAdded minimal Django integration tests.
Florian Apolloner [Sat, 15 Apr 2023 08:13:34 +0000 (10:13 +0200)] 
Added minimal Django integration tests.

2 years agochore: bump psycopg package version to 3.1.10.dev1
Daniele Varrazzo [Tue, 2 May 2023 14:29:25 +0000 (16:29 +0200)] 
chore: bump psycopg package version to 3.1.10.dev1

2 years agochore: bump psycopg package version to 3.1.9 3.1.9
Daniele Varrazzo [Tue, 2 May 2023 10:56:24 +0000 (12:56 +0200)] 
chore: bump psycopg package version to 3.1.9

2 years agoMerge branch 'fix-json-dump-dict-3.1' into maint-3.1
Daniele Varrazzo [Tue, 2 May 2023 10:54:22 +0000 (12:54 +0200)] 
Merge branch 'fix-json-dump-dict-3.1' into maint-3.1

2 years agotest(json): fix dict registration test on crdb
Daniele Varrazzo [Mon, 17 Apr 2023 21:52:06 +0000 (23:52 +0200)] 
test(json): fix dict registration test on crdb

2 years agofix(json): allow to register json dumpers on dict or other objects
Daniele Varrazzo [Mon, 10 Apr 2023 20:55:44 +0000 (22:55 +0200)] 
fix(json): allow to register json dumpers on dict or other objects

2 years agofix: don't reuse the same Transformer in composite dumper 550/head
Daniele Varrazzo [Sun, 16 Apr 2023 01:30:37 +0000 (03:30 +0200)] 
fix: don't reuse the same Transformer in composite dumper

We need different dumpers because, in case a composite contains another
composite, we need to call `dump_sequence()` on different sequences, so
we row dumpers must be distinct.

Close #547

2 years agodocs: fix cursor -> connection in the context of transaction management
Daniele Varrazzo [Thu, 13 Apr 2023 21:23:14 +0000 (23:23 +0200)] 
docs: fix cursor -> connection in the context of transaction management

Close #548

2 years agofix: don't use select as wait function if possible
Daniele Varrazzo [Sun, 9 Apr 2023 18:59:55 +0000 (20:59 +0200)] 
fix: don't use select as wait function if possible

select is marginally faster than others, but has the limitation of not
allowing FD > 1024, so it is not a good default.

If people need performance, they will use wait_c anyway, which is based
on poll, and doesn't have the limitation.

2 years agofix: fix loading of different 'record' types in the same query
Daniele Varrazzo [Sun, 9 Apr 2023 19:31:27 +0000 (21:31 +0200)] 
fix: fix loading of different 'record' types in the same query

Different records in the same query might have different types.
Use a separate transformer for each sequence of types.

2 years agofix: don't use select as wait function if possible
Daniele Varrazzo [Sun, 9 Apr 2023 18:59:55 +0000 (20:59 +0200)] 
fix: don't use select as wait function if possible

select is marginally faster than others, but has the limitation of not
allowing FD > 1024, so it is not a good default.

If people need performance, they will use wait_c anyway, which is based
on poll, and doesn't have the limitation.

2 years agofix: shorter traceback on ctrl-c interrupt
Daniele Varrazzo [Sun, 9 Apr 2023 18:45:09 +0000 (20:45 +0200)] 
fix: shorter traceback on ctrl-c interrupt

2 years agofix(async): cancel query upon receiving CanceledError in async wait
Daniele Varrazzo [Sun, 9 Apr 2023 18:29:44 +0000 (20:29 +0200)] 
fix(async): cancel query upon receiving CanceledError in async wait

This interrupt a running query upon Ctrl-C for example, which wasn't
working as it was on sync connection.

Close #543.

2 years agochore: bump mypy to 1.2
Daniele Varrazzo [Sun, 9 Apr 2023 23:42:14 +0000 (01:42 +0200)] 
chore: bump mypy to 1.2

2 years agoFix typo in docs
Jay Turner [Thu, 30 Mar 2023 08:11:18 +0000 (09:11 +0100)] 
Fix typo in docs

2 years agochore: bump psycopg_pool package version to 3.1.8.dev1
Daniele Varrazzo [Mon, 27 Mar 2023 08:41:03 +0000 (10:41 +0200)] 
chore: bump psycopg_pool package version to 3.1.8.dev1

2 years agochore: bump psycopg_pool package version to 3.1.7 pool-3.1.7
Daniele Varrazzo [Mon, 27 Mar 2023 00:07:50 +0000 (02:07 +0200)] 
chore: bump psycopg_pool package version to 3.1.7

2 years agotests: skip test_sql::test_invalid_name if not a super-user
Denis Laxalde [Thu, 23 Mar 2023 08:52:39 +0000 (09:52 +0100)] 
tests: skip test_sql::test_invalid_name if not a super-user

Creating a base type, as done in that test, requires being a superuser.

2 years agoMerge branch 'fix-509-3.1' into maint-3.1
Daniele Varrazzo [Mon, 20 Mar 2023 02:33:57 +0000 (02:33 +0000)] 
Merge branch 'fix-509-3.1' into maint-3.1

2 years agotest(pool): skip cancellation tests on Python 3.7
Daniele Varrazzo [Sun, 19 Mar 2023 19:41:14 +0000 (19:41 +0000)] 
test(pool): skip cancellation tests on Python 3.7

The test hangs forever on Python 3.7, no the gather() statement, and
wait_for() doesn't solve the problem.

2 years agofix(pool): reinforce handling of errors in queued clients
Daniele Varrazzo [Thu, 16 Mar 2023 21:15:51 +0000 (22:15 +0100)] 
fix(pool): reinforce handling of errors in queued clients

Unlike the async counterpart, I have no idea how to test this condition,
because I don't think you can cancel a Python thread. I could put the
pool and the first client in threads and use the main thread as queued
client, but it seems pretty convoluted.

However, an error handling in the same place that fixed #509 in the
async pools doesn't hurt.

2 years agofix(pool): fix handling of errors in queued async tasks
Daniele Varrazzo [Thu, 16 Mar 2023 21:07:05 +0000 (22:07 +0100)] 
fix(pool): fix handling of errors in queued async tasks

Failing to do so, cancelled tasks still in the queue end up consuming
a connection without a chance of returning it, depleting the pool.

Close #509

2 years agotest: mark some scheduler tests time-sensitive
Daniele Varrazzo [Wed, 15 Mar 2023 03:29:32 +0000 (04:29 +0100)] 
test: mark some scheduler tests time-sensitive

Close #502

2 years agofix(c): fix incomplete error message for timestamp too small
Daniele Varrazzo [Wed, 15 Mar 2023 03:24:39 +0000 (04:24 +0100)] 
fix(c): fix incomplete error message for timestamp too small

Close #521.

2 years agodoc: fix pg2pyenc() docstring
Denis Laxalde [Wed, 8 Mar 2023 09:49:54 +0000 (10:49 +0100)] 
doc: fix pg2pyenc() docstring

2 years agoMerge branch 'cython-3.0b1' into maint-3.1
Daniele Varrazzo [Wed, 15 Mar 2023 02:25:37 +0000 (03:25 +0100)] 
Merge branch 'cython-3.0b1' into maint-3.1

2 years agofix(c): add type cast to notice receiver callback
Daniele Varrazzo [Tue, 14 Mar 2023 18:36:20 +0000 (19:36 +0100)] 
fix(c): add type cast to notice receiver callback

Necessary starting from Cython 3.0b1

2 years agofix(c): solve Cython compile warnings
Daniele Varrazzo [Tue, 14 Mar 2023 18:35:57 +0000 (19:35 +0100)] 
fix(c): solve Cython compile warnings

2 years agochore: upgrade to mypy 1.0.0
Denis Laxalde [Sat, 11 Feb 2023 09:51:35 +0000 (10:51 +0100)] 
chore: upgrade to mypy 1.0.0

Some "type: ignore" no longer needed, some need a different kind.

2 years agotests: mark as flaky tests seen failing randomly on release
Daniele Varrazzo [Mon, 6 Feb 2023 21:29:32 +0000 (21:29 +0000)] 
tests: mark as flaky tests seen failing randomly on release

2 years agotest: use Windows asyncio policy in "non-asyncio" pool tests
Denis Laxalde [Sun, 5 Feb 2023 17:40:16 +0000 (18:40 +0100)] 
test: use Windows asyncio policy in "non-asyncio" pool tests

In commit b6cc8343159fc0a27365e09a3beef06433f3f1b5, we drop the global
asyncio.set_event_loop_policy() for Windows in conftest.py, replacing it
with asyncio_options to be used by the anyio test runner. However, test
cases in test_pool_async_noasyncio.py are not "async def" so they would
not use that anyio runner (nor did they use pytest-asyncio's runner
before); but they need the event loop policy for Windows still.
Accordingly, we configure the loop from "anyio_backend_options" in
asyncio_run() fixture.

2 years agotest: use anyio instead of pytest-asyncio
Denis Laxalde [Wed, 17 Aug 2022 13:59:31 +0000 (15:59 +0200)] 
test: use anyio instead of pytest-asyncio

This is in preparation for adding support for other async libraries,
through anyio. AnyIO pytest plugin is used in replacement for
pytest-asyncio:

- either the pytest.mark.asyncio is replaced by pytest.mark.anyio, or,
- we rely on the 'anyio_backend' fixture that is pulled in 'aconn_cls'
  fixture (and hence 'aconn') providing automatic detection for test
  functions using it.

The 'anyio_backend' fixture is parametrized to only use asyncio and
selects the event loop policy we need on Windows platform as previously
done in pytest_sessionstart(), but only for Python version 3.8 or
higher.

This fixture is defined in main conftest.py, as well as in
pool/conftest.py since we'll change the former to support more async
backend while keeping the later asyncio-only for now.

Function test_concurrency_async.py::test_ctrl_c is no longer 'async'
because its code does not directly use asyncio (it's done through a
subprocess); but the 'async def' was needed before in order for
pytest-asyncio to run it since the test module had a global
pytest.mark.asyncio (and we were using the "auto" mode).

2 years agoMerge branch 'fix-503' into maint-3.1
Daniele Varrazzo [Mon, 6 Feb 2023 21:17:22 +0000 (21:17 +0000)] 
Merge branch 'fix-503' into maint-3.1

2 years agofixed broken link to pip docs
Harry Lees [Fri, 3 Feb 2023 11:57:50 +0000 (11:57 +0000)] 
fixed broken link to pip docs

2 years agodocs: add news entry about TypeInfo.fetch() with sql_ascii connection fix
Daniele Varrazzo [Wed, 1 Feb 2023 01:08:33 +0000 (02:08 +0100)] 
docs: add news entry about TypeInfo.fetch() with sql_ascii connection fix

2 years agotest: test hstore registration using different encodings
Daniele Varrazzo [Wed, 1 Feb 2023 01:04:04 +0000 (02:04 +0100)] 
test: test hstore registration using different encodings

Reproduce the "emerging" bug reported in #503.

2 years agofix: fix TypeInfo.fetch() with a sql_ascii encoding connection
Daniele Varrazzo [Wed, 1 Feb 2023 00:59:01 +0000 (01:59 +0100)] 
fix: fix TypeInfo.fetch() with a sql_ascii encoding connection

Close #503

2 years agotest: add TypeInfo.fetch() test with autocommit transaction
Daniele Varrazzo [Wed, 1 Feb 2023 00:52:57 +0000 (01:52 +0100)] 
test: add TypeInfo.fetch() test with autocommit transaction

2 years agotest: reproduce the error in TypeInfo.fetch() in sql_ascii connection
Daniele Varrazzo [Wed, 1 Feb 2023 00:39:51 +0000 (01:39 +0100)] 
test: reproduce the error in TypeInfo.fetch() in sql_ascii connection

Reported in #503.

2 years agoMerge branch 'sqlalchemy_pipeline' into maint-3.1
Daniele Varrazzo [Sat, 4 Feb 2023 13:43:57 +0000 (14:43 +0100)] 
Merge branch 'sqlalchemy_pipeline' into maint-3.1

2 years agoci: add colors to pytest sqlalchemy run
Daniele Varrazzo [Sat, 4 Feb 2023 10:15:55 +0000 (11:15 +0100)] 
ci: add colors to pytest sqlalchemy run

2 years agoci: allow better job visualization in Action page
Daniele Varrazzo [Sat, 4 Feb 2023 10:08:48 +0000 (11:08 +0100)] 
ci: allow better job visualization in Action page

2 years agoci: fix postgres service in 3rd party workflow
Daniele Varrazzo [Sat, 4 Feb 2023 10:05:11 +0000 (11:05 +0100)] 
ci: fix postgres service in 3rd party workflow

2 years agoci: add sqlalchemy integration pipeline
Federico Caselli [Tue, 17 Jan 2023 21:51:02 +0000 (22:51 +0100)] 
ci: add sqlalchemy integration pipeline

2 years agochore: upgrade black to 23.1.0
Daniele Varrazzo [Wed, 1 Feb 2023 10:25:26 +0000 (11:25 +0100)] 
chore: upgrade black to 23.1.0

Code reformatted to adhere to the new style requested (stricter on
redundant tuples unpacking brackets and blank lines at blocks start).

2 years agochore: bump psycopg package version to 3.1.9.dev1
Daniele Varrazzo [Wed, 1 Feb 2023 01:14:51 +0000 (02:14 +0100)] 
chore: bump psycopg package version to 3.1.9.dev1

2 years agoci: bump to PostgreSQL 15 on macOS package build
Daniele Varrazzo [Tue, 17 Jan 2023 01:38:35 +0000 (02:38 +0100)] 
ci: bump to PostgreSQL 15 on macOS package build

Try to do without brew update, which at the moment downloads half a
million of packages we don't use and then barfs on some java crap.

2 years agochore: bump cibuildwheel to 2.12.0
Daniele Varrazzo [Mon, 16 Jan 2023 23:58:15 +0000 (00:58 +0100)] 
chore: bump cibuildwheel to 2.12.0

Checking if this fixes the current error in Github Actions, where the
macOS builds fail on `brew update`.

2 years agochore: bump psycopg_pool package version to 3.1.7.dev1
Daniele Varrazzo [Sat, 28 Jan 2023 17:14:32 +0000 (18:14 +0100)] 
chore: bump psycopg_pool package version to 3.1.7.dev1

2 years agochore: bump psycopg_pool package version to 3.1.6 pool-3.1.6
Daniele Varrazzo [Sat, 28 Jan 2023 16:52:26 +0000 (17:52 +0100)] 
chore: bump psycopg_pool package version to 3.1.6

2 years agoMerge branch 'kwargs-begone' into maint-3.1
Daniele Varrazzo [Sat, 28 Jan 2023 16:51:59 +0000 (17:51 +0100)] 
Merge branch 'kwargs-begone' into maint-3.1

2 years agodocs(pool): mention change in constructors signatures in the news
Daniele Varrazzo [Sat, 28 Jan 2023 16:46:33 +0000 (17:46 +0100)] 
docs(pool): mention change in constructors signatures in the news

2 years agorefactor(pool): make constructor configuration parameters type-safe
Ran Benita [Tue, 24 Jan 2023 20:59:55 +0000 (22:59 +0200)] 
refactor(pool): make constructor configuration parameters type-safe

Previously, arguments to ConnectionPool and friends would be forwarded
using `**kwargs` to `BasePool`. This is however not type-safe, and
prevents code editors from auto-completing the parameters.

Drop the `**kwargs`, duplicate the parameters instead.

Fixes #493.

2 years agochore: bump psycopg package version to 3.1.8
Daniele Varrazzo [Mon, 16 Jan 2023 21:53:48 +0000 (22:53 +0100)] 
chore: bump psycopg package version to 3.1.8

2 years agoFixed TypeInfo for ClientCursor.
Florian Apolloner [Mon, 16 Jan 2023 20:09:21 +0000 (21:09 +0100)] 
Fixed TypeInfo for ClientCursor.

TypeInfo had a hardcoded binary=True which doesn't work to well for
ClientCursor.

2 years agoMerge branch 'rowcount' into maint-3.1
Daniele Varrazzo [Mon, 9 Jan 2023 17:45:22 +0000 (17:45 +0000)] 
Merge branch 'rowcount' into maint-3.1

2 years agofix: set rowcount to the first result in executemany(..., returning=True)
Denis Laxalde [Sat, 7 Jan 2023 15:01:36 +0000 (16:01 +0100)] 
fix: set rowcount to the first result in executemany(..., returning=True)

Previously, _rowcount was unconditionally set to the overall number of
rows of all queries in executemany() and then reset only upon the first
call to nextset(). In the returning=True case, this lead the rowcount
attribute to be wrong for the first result (i.e. it didn't match the
number of rows that would be returned by .fetchall(), as can be seen in
updated tests).

Now we only set _rowcount to the cumulated number of rows of executed
queries *if* executemany() is not returning (so the value is still
useful, e.g., in to check the number of INSERTed rows):

    >>> cur.executemany("INSERT INTO t(r) VALUES (%s)", [(1,), (2,)])
    >>> cur.rowcount
    2  # number of inserted rows
    >>> cur.nextset()
    >>> cur.executemany("INSERT INTO t(r) VALUES (%s) RETURNING r", [(1,), (2,)], returning=True)
    >>> cur.rowcount
    1  # number of rows in the first result set
    >>> cur.fetchall()
    [(1,)]
    >>> cur.nextset()
    True
    >>> cur.rowcount
    1
    >>> cur.fetchall()
    [(2,)]
    >>> cur.nextset()

Besides, the code for processing results from executemany() in
_executemany_gen_no_pipeline() is now similar to that of
_set_results_from_pipeline().

2 years agorefactor: drop superfluous _rowcount reset
Denis Laxalde [Sun, 8 Jan 2023 14:48:38 +0000 (15:48 +0100)] 
refactor: drop superfluous _rowcount reset

In BaseCursor._set_results_from_pipeline() we were resetting _rowcount
if negative. This is superfluous as this code is reached when coming
from _executemany_gen_pipeline() in which we already do
'self._rowcount = 0' early on.

2 years agoci: install the "oldest" libpq from pgdg repository
Denis Laxalde [Sat, 7 Jan 2023 18:50:37 +0000 (19:50 +0100)] 
ci: install the "oldest" libpq from pgdg repository

2 years agodoc: fix typo unless -> unlike
Daniele Varrazzo [Sat, 7 Jan 2023 12:54:49 +0000 (12:54 +0000)] 
doc: fix typo unless -> unlike

2 years agorefactor: drop internal use of Union[] type definition in TypeInfo.fetch()
Daniele Varrazzo [Fri, 6 Jan 2023 17:29:59 +0000 (17:29 +0000)] 
refactor: drop internal use of Union[] type definition in TypeInfo.fetch()

2 years agofix: use more uniformly the to_regtype function
Daniele Varrazzo [Fri, 6 Jan 2023 17:21:19 +0000 (17:21 +0000)] 
fix: use more uniformly the to_regtype function

Make the knowledge of the function to use independent from the knowledge
of the types implemented by a certain database.

2 years agotest(crdb): fix flakey test
Daniele Varrazzo [Fri, 6 Jan 2023 13:35:38 +0000 (13:35 +0000)] 
test(crdb): fix flakey test

We often find a "delete" record more than once in the changefeed, before
deleting it. Tolerate one.

2 years agoUse to_regtype instead of ::regtype in type info queries on supported dbs
Federico Caselli [Thu, 5 Jan 2023 21:41:29 +0000 (22:41 +0100)] 
Use to_regtype instead of ::regtype in type info queries on supported dbs

2 years agofix: report the MultirangeInfo object exposed by psycopg.types.multirange
Daniele Varrazzo [Tue, 3 Jan 2023 19:40:38 +0000 (19:40 +0000)] 
fix: report the MultirangeInfo object exposed by psycopg.types.multirange

2 years agoMerge branch 'build-backend' into maint-3.1
Daniele Varrazzo [Tue, 3 Jan 2023 13:14:19 +0000 (13:14 +0000)] 
Merge branch 'build-backend' into maint-3.1

2 years agoci: add in-tree build backend to avoid installing Cython if not needed
Daniele Varrazzo [Mon, 2 Jan 2023 01:59:26 +0000 (01:59 +0000)] 
ci: add in-tree build backend to avoid installing Cython if not needed

Only install Cython when there are pyx files to build. If there aren't,
it means that the c files are already available and Cython is not
required.

Close #471.

2 years agoci: use the 'build' python package as build frontend
Daniele Varrazzo [Mon, 2 Jan 2023 03:26:32 +0000 (03:26 +0000)] 
ci: use the 'build' python package as build frontend

2 years agoci: fix building source packages
Daniele Varrazzo [Mon, 2 Jan 2023 03:01:41 +0000 (03:01 +0000)] 
ci: fix building source packages

Something was broken recently and installing from the package root
doesn't work anymore.

2 years agoMerge branch 'test-lower-bound-dependencies' into maint-3.1
Daniele Varrazzo [Mon, 2 Jan 2023 04:13:32 +0000 (04:13 +0000)] 
Merge branch 'test-lower-bound-dependencies' into maint-3.1

2 years agoci: include a single test with the oldest dependencies versions
Daniele Varrazzo [Sat, 31 Dec 2022 03:07:39 +0000 (03:07 +0000)] 
ci: include a single test with the oldest dependencies versions

2 years agochore: update the lower bound dependencies in the constraint file
Daniele Varrazzo [Sat, 31 Dec 2022 03:07:17 +0000 (03:07 +0000)] 
chore: update the lower bound dependencies in the constraint file

Lower minimum dependency on pytest-randomly to version 3.5, as
version 3.6 requires a newer importlib-metadata.

2 years agofix: raise known errors before checking for signals in waiting
Daniele Varrazzo [Mon, 26 Dec 2022 03:47:42 +0000 (03:47 +0000)] 
fix: raise known errors before checking for signals in waiting

2 years agotest: add psycopg2 in green mode to benchmark script
Daniele Varrazzo [Mon, 26 Dec 2022 06:09:34 +0000 (06:09 +0000)] 
test: add psycopg2 in green mode to benchmark script

This is a more accurate comparison between psycopg2 and 3.

2 years agotest: add --concurrency option to benchmark script
Daniele Varrazzo [Fri, 23 Dec 2022 04:24:51 +0000 (04:24 +0000)] 
test: add --concurrency option to benchmark script

Investigate the poor parallelism mentioned in #448.

2 years agostyle: uniform variable name between sync and async cursor
Daniele Varrazzo [Wed, 28 Dec 2022 03:26:43 +0000 (03:26 +0000)] 
style: uniform variable name between sync and async cursor

2 years agofix: raise OperationalError instead of MemoryError on several operations
Daniele Varrazzo [Fri, 23 Dec 2022 18:04:14 +0000 (18:04 +0000)] 
fix: raise OperationalError instead of MemoryError on several operations

Failure is related to the operation executed, not to memory not
available to store the result.

2 years agochore: add Documentation, Changes links to metadata
Daniele Varrazzo [Thu, 29 Dec 2022 00:48:22 +0000 (00:48 +0000)] 
chore: add Documentation, Changes links to metadata

2 years agofeat(bump-version): add --actions option
Daniele Varrazzo [Thu, 29 Dec 2022 00:31:30 +0000 (00:31 +0000)] 
feat(bump-version): add --actions option

2 years agochore(c): lean win32
Daniele Varrazzo [Thu, 22 Dec 2022 22:19:07 +0000 (22:19 +0000)] 
chore(c): lean win32

2 years agochore(c): fix build warnings on win32
Daniele Varrazzo [Thu, 22 Dec 2022 21:28:12 +0000 (21:28 +0000)] 
chore(c): fix build warnings on win32

2 years agoci: uniform and clean up test workflow
Daniele Varrazzo [Thu, 22 Dec 2022 16:25:40 +0000 (16:25 +0000)] 
ci: uniform and clean up test workflow

2 years agotest(crdb): skip inet tests on v22.2.1
Daniele Varrazzo [Thu, 22 Dec 2022 22:48:44 +0000 (22:48 +0000)] 
test(crdb): skip inet tests on v22.2.1

Work around https://github.com/cockroachdb/cockroach/issues/94192

2 years agochore(pool): add pyproject.toml
Daniele Varrazzo [Thu, 22 Dec 2022 19:07:10 +0000 (19:07 +0000)] 
chore(pool): add pyproject.toml

2 years agoci: configure the database to run two-phase-commit tests
Daniele Varrazzo [Tue, 20 Dec 2022 20:19:23 +0000 (20:19 +0000)] 
ci: configure the database to run two-phase-commit tests

We can't use the Github Actions PostgreSQL service because it doesn't
seem possible to configure the server for stored transactions:

- the service yaml definition doesn't take args to pass to run
- we can't overwrite the entry point with a script of ours because the
  service starts before actions/checkout
- the postgres image doesn't allow to pass extra parameters to the
  server via an env var

2 years agotest: fix int mixin enum in test
Daniele Varrazzo [Thu, 22 Dec 2022 03:04:10 +0000 (03:04 +0000)] 
test: fix int mixin enum in test