]>
git.ipfire.org Git - thirdparty/psycopg.git/log
Daniele Varrazzo [Mon, 29 Nov 2021 01:13:23 +0000 (02:13 +0100)]
Reduce the work done on the cursor by executemany
Certain functions were executed once per query (e.g. _make_row_maker(),
_tx.set_pgresult()) but we can run them only once.
Daniele Varrazzo [Mon, 13 Dec 2021 12:34:20 +0000 (13:34 +0100)]
Finalise version 3.0.6 for release
Daniele Varrazzo [Thu, 9 Dec 2021 19:17:05 +0000 (20:17 +0100)]
Don't run Mypy tests on Windows/macOS
These tests are kinda slow and these platforms are the slowest to run.
Testing Mypy on Linux covers other platforms too.
A sample GitHub tests run (with no other concurrent job) went down from
22m to 18m.
Daniele Varrazzo [Thu, 9 Dec 2021 16:14:58 +0000 (17:14 +0100)]
Merge branch 'fix-177'
Detect out-of-order transactions exit when they have the same name too.
Daniele Varrazzo [Thu, 9 Dec 2021 14:24:57 +0000 (15:24 +0100)]
Detect out-of-order transactions exit when they have the same name too
Close #177
Daniele Varrazzo [Thu, 9 Dec 2021 13:56:53 +0000 (14:56 +0100)]
Don't try to execute transaction finalization with the connection closed
Daniele Varrazzo [Thu, 9 Dec 2021 13:55:28 +0000 (14:55 +0100)]
Refactor Transaction queries generation into internal methods
Daniele Varrazzo [Thu, 9 Dec 2021 13:30:33 +0000 (14:30 +0100)]
Refactor Transaction adding an internal push method
Nice and symmetric w.r.t. the pop method recently introduced.
Daniele Varrazzo [Thu, 9 Dec 2021 13:27:33 +0000 (14:27 +0100)]
Add tests to verify out-of-order detections without threads
Daniele Varrazzo [Thu, 9 Dec 2021 00:03:26 +0000 (01:03 +0100)]
Merge branch 'transaction-concurrency'
Daniele Varrazzo [Wed, 8 Dec 2021 23:28:44 +0000 (00:28 +0100)]
Raise ProgrammingError on out-of-order exit from transactions
Previously it would have failed an assert.
Further back in time, the condition was checked and reported as
ProgrammingError already. The check was dropped when
`conn.transaction()` started to return an entered transaction, so the
possibility of calling enter/exit manually was taken out of the public
API. However, we didn't consider the possibility of concurrent
threads operating on transaction independently.
Also fix the Transaction representation, which wouldn't have reported
`(terminated)` exiting on rollback, but only on commit.
Close #176.
Daniele Varrazzo [Wed, 8 Dec 2021 19:54:34 +0000 (20:54 +0100)]
Make the test to detect out-of-order transaction exiting reliable
Denis Laxalde [Wed, 8 Dec 2021 15:53:05 +0000 (16:53 +0100)]
Test transactions with concurrence [skip ci]
Daniele Varrazzo [Wed, 8 Dec 2021 14:39:07 +0000 (15:39 +0100)]
Fix docs typo
Daniele Varrazzo [Wed, 8 Dec 2021 14:28:13 +0000 (15:28 +0100)]
Improve Dumper, Loader documentation
Daniele Varrazzo [Wed, 8 Dec 2021 12:46:26 +0000 (13:46 +0100)]
Reword the types package description with more links to relevant docs
Daniele Varrazzo [Wed, 8 Dec 2021 03:39:09 +0000 (04:39 +0100)]
Fix duplicate docs for Cursor.description
Daniele Varrazzo [Wed, 8 Dec 2021 03:11:41 +0000 (04:11 +0100)]
Add ConnStatus.CHECK_STANDBY enum value
Added in PostgreSQL 14, only visible during connection, if at all.
Daniele Varrazzo [Wed, 8 Dec 2021 03:22:12 +0000 (04:22 +0100)]
Reword PyFormat docs
Daniele Varrazzo [Wed, 8 Dec 2021 02:51:48 +0000 (03:51 +0100)]
Fix a couple of typos in pool docs
Daniele Varrazzo [Tue, 7 Dec 2021 22:01:15 +0000 (23:01 +0100)]
Merge pull request #167 from dlax/trace
Add bindings for PQ tracing functions
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.