]>
git.ipfire.org Git - thirdparty/psycopg.git/log
Daniele Varrazzo [Tue, 7 Dec 2021 20:53:06 +0000 (21:53 +0100)]
Mention addition of trace function in news file
Daniele Varrazzo [Tue, 7 Dec 2021 21:02:59 +0000 (22:02 +0100)]
Report that trace is *currently* only supported on linux in errors
We will add support for other platforms, if others care.
Denis Laxalde [Mon, 6 Dec 2021 07:44:02 +0000 (08:44 +0100)]
Add a --pq-tracefile pytest option
When specified, we'd enable tracing of the client/server communication
to a file. The file is opened for the whole test session and we set a
title section before each test run.
Denis Laxalde [Fri, 3 Dec 2021 07:05:16 +0000 (08:05 +0100)]
Add bindings for PQ tracing functions
Since we cannot pass a file descriptor as a FILE value, as expected by
PQtrace(), PGconn.trace() method accepts a 'fileno: int' value. This is
then used to build an stdio's FILE value through fdopen(). The latter
also needs a binding in ctypes. This only works on Linux platform.
In _pq_ctypes.pyi, fdopen() and PQtrace() are not autogenerated because
of the needed '# type: ignore' (similar to existing ones).
PQsetTraceFlags() is new from libpq 14, so we declare it conditionally.
Daniele Varrazzo [Tue, 7 Dec 2021 21:30:12 +0000 (22:30 +0100)]
Flag the bugfix version unreleased in the docs news
Daniele Varrazzo [Tue, 7 Dec 2021 20:31:07 +0000 (21:31 +0100)]
Don't raise an exception using cur.description with closed connection
Close #172.
Daniele Varrazzo [Tue, 7 Dec 2021 20:01:13 +0000 (21:01 +0100)]
Raise OperationalError on Connection.cursor() if closed
Daniele Varrazzo [Tue, 7 Dec 2021 19:49:15 +0000 (20:49 +0100)]
Drop unneeded sort() in test
Daniele Varrazzo [Tue, 7 Dec 2021 19:40:51 +0000 (20:40 +0100)]
Fix whitespace excess
Reported as error by new black version.
Daniele Varrazzo [Tue, 7 Dec 2021 19:31:00 +0000 (20:31 +0100)]
Don't raise exceptions on ServerError.close() if the connection is closed
Close #173.
Denis Laxalde [Fri, 3 Dec 2021 11:15:45 +0000 (12:15 +0100)]
Drop a few unused imports in pgconn.pyx
Denis Laxalde [Fri, 3 Dec 2021 08:23:25 +0000 (09:23 +0100)]
Add _PQencryptPasswordConn() in _pq_ctypes.pyi
Running the generation script produces this diff.
Daniele Varrazzo [Fri, 3 Dec 2021 09:23:33 +0000 (10:23 +0100)]
test: run tests against PostgreSQL 14 on macOS
brew gives an error installing v. 13.
Daniele Varrazzo [Mon, 29 Nov 2021 11:01:51 +0000 (12:01 +0100)]
Merge branch 'preparing-refactor'
Daniele Varrazzo [Wed, 17 Nov 2021 14:26:43 +0000 (15:26 +0100)]
Remove prepared statement maintenance command out of the normal loop
Accumulate the maintenance commands in the state of the prepared
processor manager and decide when to process them.
Daniele Varrazzo [Wed, 17 Nov 2021 13:15:20 +0000 (14:15 +0100)]
Split the internal state of prepared statements into names and counts
Daniele Varrazzo [Wed, 17 Nov 2021 13:27:35 +0000 (14:27 +0100)]
Refactor away internal prepared statements manager function
Daniele Varrazzo [Tue, 16 Nov 2021 14:19:40 +0000 (15:19 +0100)]
Drop PrepareManger.maintain()
Daniele Varrazzo [Tue, 16 Nov 2021 14:13:49 +0000 (15:13 +0100)]
reimplement PrepareManager.maintain() calling other public methods
This makes clearer that, in pipeline mode, we call them in two different
moments, whereas in non-pipeline we call them in a single place.
Daniele Varrazzo [Tue, 16 Nov 2021 13:58:08 +0000 (14:58 +0100)]
Rename prepare manager methods
Underscore the methods that are only called internally.
Change some of the public names. However this is just temporary, to
reason about who calls what.
Daniele Varrazzo [Tue, 16 Nov 2021 13:16:57 +0000 (14:16 +0100)]
Use the clear() method in PrepareManager.maintain()
Denis Laxalde [Mon, 18 Oct 2021 09:42:11 +0000 (11:42 +0200)]
Add handle() and validate() methods to PrepareManager
These essentially perform the same steps as maintain() but with only
query information first, and then once results become available.
Denis Laxalde [Mon, 18 Oct 2021 09:31:33 +0000 (11:31 +0200)]
Add a rotate() method to PrepareManager
Denis Laxalde [Mon, 18 Oct 2021 09:31:33 +0000 (11:31 +0200)]
Add a check_results() method to PrepareManager
Denis Laxalde [Mon, 18 Oct 2021 09:28:03 +0000 (11:28 +0200)]
Add a setdefault() method to PrepareManager
Denis Laxalde [Mon, 18 Oct 2021 09:18:12 +0000 (11:18 +0200)]
Add a should_discard() method to PrepareManager
Denis Laxalde [Mon, 18 Oct 2021 09:00:28 +0000 (11:00 +0200)]
Add a key() method to PrepareManager
Daniele Varrazzo [Sun, 28 Nov 2021 23:16:24 +0000 (00:16 +0100)]
Peg version of the docs theme package
Daniele Varrazzo [Sun, 28 Nov 2021 22:49:40 +0000 (23:49 +0100)]
Install the pool in the docs environment in editable mode
Daniele Varrazzo [Sun, 28 Nov 2021 22:39:36 +0000 (23:39 +0100)]
Add sphinx link to docs footer, drop page source link
Daniele Varrazzo [Sun, 28 Nov 2021 19:24:46 +0000 (20:24 +0100)]
Merge branch 'two-phase-commit'
Daniele Varrazzo [Sun, 28 Nov 2021 18:50:59 +0000 (19:50 +0100)]
Close connections in TPC tests to avoid warnings in tests
Daniele Varrazzo [Sun, 28 Nov 2021 18:26:24 +0000 (19:26 +0100)]
Add documentation for two-phase commit support
Daniele Varrazzo [Mon, 8 Nov 2021 14:43:39 +0000 (15:43 +0100)]
Add type annotations to two-phase commit tests
Daniele Varrazzo [Sat, 30 Oct 2021 17:44:37 +0000 (19:44 +0200)]
Move two-phase transaction fixture to a common place
Importing it across test cases requires too silly workarounds.
Also do without attrgetter.
Daniele Varrazzo [Sat, 30 Oct 2021 17:35:28 +0000 (19:35 +0200)]
Add two-phase support method to async connection
Daniele Varrazzo [Tue, 26 Oct 2021 23:50:45 +0000 (01:50 +0200)]
Add two-phase commit DBAPI Connection methods
Daniele Varrazzo [Tue, 26 Oct 2021 15:58:21 +0000 (16:58 +0100)]
Drop in dbapi tests for two-phase commit support
Daniele Varrazzo [Sun, 28 Nov 2021 17:02:32 +0000 (18:02 +0100)]
Start working on Psycopg 3.1
Daniele Varrazzo [Sun, 28 Nov 2021 16:52:07 +0000 (17:52 +0100)]
Bump to next release number
Daniele Varrazzo [Sun, 28 Nov 2021 16:40:37 +0000 (17:40 +0100)]
Merge branch 'fix-165'
Daniele Varrazzo [Sun, 28 Nov 2021 16:15:16 +0000 (17:15 +0100)]
Don't clobber exception if rollback fails on transaction exit
Just raise a warning, consistently with what happens to the connection.
Close #165.
Daniele Varrazzo [Sun, 28 Nov 2021 16:39:54 +0000 (17:39 +0100)]
Merge branch 'fix-158'
Daniele Varrazzo [Sat, 27 Nov 2021 22:30:53 +0000 (23:30 +0100)]
Make sure to close selectors after usage
Failing to do so leaks file descriptors and may lead to "Too many open
files" errors (experienced on macOS, using kqueue selector).
Close #158
Daniele Varrazzo [Sat, 27 Nov 2021 23:08:27 +0000 (00:08 +0100)]
docs: fetch libpq functions index from PostgreSQL 14 docs
Daniele Varrazzo [Tue, 23 Nov 2021 20:23:47 +0000 (21:23 +0100)]
Improve a few adaptation-related error messages
Daniele Varrazzo [Tue, 23 Nov 2021 20:22:30 +0000 (21:22 +0100)]
Gitignore the build directories, but not /tools/build/
Consolidate other local ignores into the main one, as all the ignores
are generic.
Daniele Varrazzo [Mon, 22 Nov 2021 01:44:49 +0000 (02:44 +0100)]
Guard delay_connection in tests for negative sleep argument
It happens if connection time was slow enough.
Daniele Varrazzo [Mon, 22 Nov 2021 01:23:36 +0000 (02:23 +0100)]
Use an empty string instead on None in the copy work queue
The test for copy end is just "if not item", so the empty string is
actually never used as a piece of data. This simplifies the type of the
queue.
Daniele Varrazzo [Sun, 21 Nov 2021 20:24:48 +0000 (21:24 +0100)]
Fix typo in comment
Denis Laxalde [Sun, 21 Nov 2021 08:49:58 +0000 (09:49 +0100)]
Add a minimal coverage configuration
We use pytest-cov, as it enables running coverage with pytest in a
single command.
We exclude 'if TYPE_CHECKING:' and ellipsis lines from report.
Daniele Varrazzo [Tue, 16 Nov 2021 10:31:42 +0000 (11:31 +0100)]
Merge pull request #120 from dlax/waiting
support RW ready in waiting functions
Denis Laxalde [Tue, 12 Oct 2021 13:40:36 +0000 (15:40 +0200)]
Possibly send a Ready.RW value to generators waiting on RW
In some generators, we might be interested in receiving both read-ready
and write-ready event at the same time.
Per previous commits, all wait*() functions support this.
This is covered by test_wait_ready(), which now maps Wait.RW to
Ready.RW.
Denis Laxalde [Fri, 12 Nov 2021 13:34:43 +0000 (14:34 +0100)]
Always stop monitoring fds in wait_{,conn_}async()
Denis Laxalde [Thu, 11 Nov 2021 09:59:59 +0000 (10:59 +0100)]
Handle RW-ready in wait(,_conn)_async()
Denis Laxalde [Sun, 17 Oct 2021 19:02:41 +0000 (21:02 +0200)]
Add an assertion in wait_selector() / wait_epoll()
Making sure the ready event matches what we're waiting on.
Denis Laxalde [Sun, 17 Oct 2021 18:59:58 +0000 (20:59 +0200)]
Fix wait_epoll() when the fd is read- and write-ready
We follow the implementation of EpollSelector.select(). The
test_wait_ready() introduced previously added now passes for
wait_epoll().
Denis Laxalde [Sun, 17 Oct 2021 15:25:32 +0000 (17:25 +0200)]
Add unit tests for wait*() functions
We check that when a generator waits for a Wait value, it gets a Ready
value that matches. The socket we wait on is read- and write-ready.
These tests hang on non-Linux platform in CI, perhaps because some
socket operations (e.g. fileno()) are not portable, so we only run them
on Linux.
As is, wait_epoll() fails this test because it assumes that readiness is
either read or write, not both.
Daniele Varrazzo [Mon, 15 Nov 2021 01:15:47 +0000 (02:15 +0100)]
Warm up database before running tests
Sometimes, in the test CI, the first connection may take a long time,
and if the first test is about connection timeout, it might fail.
https://github.com/psycopg/psycopg/runs/
4206004327 ?check_suite_focus=true
Daniele Varrazzo [Mon, 15 Nov 2021 00:00:45 +0000 (01:00 +0100)]
Disable running CI tests on tag
At least I hope. According to GitHub Docs [1]:
> If you define only `tags` or only `branches`, the workflow won't run for
> events affecting the undefined Git ref.
[1]: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
Daniele Varrazzo [Sun, 14 Nov 2021 23:36:06 +0000 (00:36 +0100)]
Fix sentence about binary packages not supporting Alpine Linux
Daniele Varrazzo [Sun, 14 Nov 2021 23:28:35 +0000 (00:28 +0100)]
Add missing classifiers for Python 3.10
Daniele Varrazzo [Sun, 14 Nov 2021 23:27:20 +0000 (00:27 +0100)]
Bump to next dev packages
Daniele Varrazzo [Sun, 14 Nov 2021 21:58:14 +0000 (22:58 +0100)]
Set packages version numbers for release
Daniele Varrazzo [Sun, 14 Nov 2021 21:55:41 +0000 (22:55 +0100)]
Add mention to the libpq upgrade ticket in out tracker
Close #149.
Daniele Varrazzo [Sun, 14 Nov 2021 21:48:40 +0000 (22:48 +0100)]
Merge branch 'upgrade-lipbq'
Daniele Varrazzo [Sun, 14 Nov 2021 21:48:22 +0000 (22:48 +0100)]
Mention libpq upgrade in news file
Daniele Varrazzo [Thu, 11 Nov 2021 21:14:11 +0000 (22:14 +0100)]
Upgrade libpq in Windows packages
Daniele Varrazzo [Thu, 11 Nov 2021 21:20:38 +0000 (22:20 +0100)]
Update alpine linux packages before building wheels
Daniele Varrazzo [Thu, 11 Nov 2021 20:37:20 +0000 (21:37 +0100)]
Upgrade libpq in macOS packages
Daniele Varrazzo [Thu, 11 Nov 2021 22:12:16 +0000 (23:12 +0100)]
strip_wheel: don't require to install the zip system package
Use the zipfile module command line.
Daniele Varrazzo [Thu, 11 Nov 2021 21:56:16 +0000 (22:56 +0100)]
strip_wheel: pass script parameters to the strip command
Daniele Varrazzo [Sun, 14 Nov 2021 18:30:18 +0000 (19:30 +0100)]
Initialize UTC in the timezones cache
Not having it might cause spurious errors in particular cases, we see it
failing sometimes in the CI on Windows (which lacks the timezone
database) on Python 3.6 with a ridiculous:
unknown PostgreSQL timezone: 'UTC'; will use UTC
The similar cache on the Python side is primed the same way.
Daniele Varrazzo [Sun, 14 Nov 2021 19:34:22 +0000 (20:34 +0100)]
Dispose more carefully of connections and threads in concurrency tests
I have seen some segfault on Windows sometimes, probably with the
test_concurrency thread stomping over the memory of the process forked
in test_multiprocess_close.
Async tests refactored the same way, although they don't exhibit the
same problem.
Daniele Varrazzo [Sun, 14 Nov 2021 18:52:42 +0000 (19:52 +0100)]
Fix CI tests
I made this change earlier but committed the wrong branch... Sowwy.
Daniele Varrazzo [Sun, 14 Nov 2021 17:41:33 +0000 (18:41 +0100)]
Drop unneeded 'cursor()' in docs
Daniele Varrazzo [Sun, 14 Nov 2021 17:20:16 +0000 (18:20 +0100)]
Configure pytest color output in test using env var
Less repetitions.
Denis Laxalde [Sun, 14 Nov 2021 16:15:10 +0000 (17:15 +0100)]
Configure pytest warning control in pyproject.toml
This reduces duplication and makes the configuration available when
testing outside CI.
Daniele Varrazzo [Sat, 13 Nov 2021 22:58:54 +0000 (23:58 +0100)]
Specify older libpq in test matrix now that 14 is the default.
Daniele Varrazzo [Sun, 14 Nov 2021 00:10:19 +0000 (01:10 +0100)]
Fix Python version in Windows test
Daniele Varrazzo [Sat, 13 Nov 2021 23:38:27 +0000 (00:38 +0100)]
Add news entry about _compat dependency removed.
Daniele Varrazzo [Sat, 13 Nov 2021 22:41:42 +0000 (23:41 +0100)]
Add psycopg_pool._compat module.
Using psycopg._compat creates an unwanted coupling between the modules.
As it is now psycopg_pool 3.0.1 is not compatible with psycopg < 3.0.3
because of the dependency on Deque added in
1a5b09b2 .
Daniele Varrazzo [Sat, 13 Nov 2021 22:25:54 +0000 (23:25 +0100)]
Less strict gitignore of the 'build' dir
It was hiding changes in the `tools/build` directory...
Daniele Varrazzo [Sat, 13 Nov 2021 22:25:06 +0000 (23:25 +0100)]
Bump pool version number to next dev release
Daniele Varrazzo [Sat, 13 Nov 2021 22:20:44 +0000 (23:20 +0100)]
Add news entry about zoneinfo segfault fix
Daniele Varrazzo [Sat, 13 Nov 2021 22:15:08 +0000 (23:15 +0100)]
Merge branch 'stricter-tests'
Daniele Varrazzo [Sat, 13 Nov 2021 22:08:05 +0000 (23:08 +0100)]
Docs typo fixed
Daniele Varrazzo [Sat, 13 Nov 2021 17:15:58 +0000 (18:15 +0100)]
Solve race conditions in test
Daniele Varrazzo [Sat, 13 Nov 2021 17:01:28 +0000 (18:01 +0100)]
Silence test warnings on Python 3.6
Daniele Varrazzo [Sat, 13 Nov 2021 18:16:52 +0000 (19:16 +0100)]
Fix segfault using timezones on Python 3.6 in -Werror mode
Also fix a couple of attribute errors in less used code paths (in the
branches reporting errors when using unsupported datestyles).
Related: https://github.com/pganssle/zoneinfo/issues/109
Daniele Varrazzo [Sat, 13 Nov 2021 14:56:43 +0000 (15:56 +0100)]
Close all the resources during tests
This allows to run the test suite with -Werror.
Daniele Varrazzo [Sat, 13 Nov 2021 16:14:46 +0000 (17:14 +0100)]
Raise error on warnings in tests
Daniele Varrazzo [Sat, 13 Nov 2021 16:12:21 +0000 (17:12 +0100)]
Assume Python 3.10 available in the test runners
Daniele Varrazzo [Sat, 13 Nov 2021 14:05:19 +0000 (15:05 +0100)]
Drop string-bytes comparisons
They were mostly internal ones, coming from dicts containing strings and
bytes as keys.
Close #147
Daniele Varrazzo [Sat, 13 Nov 2021 15:02:46 +0000 (16:02 +0100)]
Enable error on str-bytes comparison in pytest
See #147
Daniele Varrazzo [Thu, 11 Nov 2021 21:49:34 +0000 (22:49 +0100)]
Shorter names in the build
This way we should be able to more of the grid parameters in the left
column of the Github build run page.
Daniele Varrazzo [Thu, 11 Nov 2021 20:02:09 +0000 (21:02 +0100)]
Bump to next dev release
Mikel Olasagasti Uranga [Wed, 10 Nov 2021 23:31:19 +0000 (00:31 +0100)]
Update dep on pytest-asyncio
Works fine with 0.16.0
See #143
Daniele Varrazzo [Wed, 10 Nov 2021 13:30:31 +0000 (14:30 +0100)]
Bump version numbers to release psycopg 3.0.3 and pool 3.0.1
Daniele Varrazzo [Wed, 10 Nov 2021 13:28:38 +0000 (14:28 +0100)]
Fix duplicate sentence in connection pool docs