]>
git.ipfire.org Git - thirdparty/psycopg.git/log
Daniele Varrazzo [Sun, 2 Jan 2022 19:37:14 +0000 (20:37 +0100)]
Add returning parameter on executemany()
Denis Laxalde [Wed, 15 Dec 2021 12:57:31 +0000 (13:57 +0100)]
Keep results from all queries run through executemany()
Instead of overwriting cursor's results at each execution in
executemany() we now accumulate the results of all queries on cursor
state by turning _set_results() into _extend_results(). This way, each
result remains accessible and one can use nextset() to move from one
result to another.
Daniele Varrazzo [Sun, 2 Jan 2022 20:02:26 +0000 (21:02 +0100)]
Drop unneeded method signatures in docs
Daniele Varrazzo [Sun, 2 Jan 2022 18:47:37 +0000 (19:47 +0100)]
Rename a couple of internal cursor methods for clarity
Daniele Varrazzo [Sun, 2 Jan 2022 18:46:32 +0000 (19:46 +0100)]
Refactor cur._raise_from_results() into _raise_for_result()
The case of raising with different statuses doesn't practically happen.
Daniele Varrazzo [Sun, 2 Jan 2022 18:22:34 +0000 (19:22 +0100)]
Drop Cursor._set_results()
Split it into a _check_results() and leave the caller manage the cursor state.
Daniele Varrazzo [Sun, 2 Jan 2022 19:06:45 +0000 (20:06 +0100)]
Shorten traceback on executemany
Daniele Varrazzo [Sun, 2 Jan 2022 18:59:02 +0000 (19:59 +0100)]
Fix typo in comment
Daniele Varrazzo [Sun, 2 Jan 2022 17:58:17 +0000 (18:58 +0100)]
Fix test suite to run on database in locales different from English
Daniele Varrazzo [Sun, 2 Jan 2022 17:03:08 +0000 (18:03 +0100)]
Note in news file that 3.0.8 is still unreleased
Daniele Varrazzo [Sun, 2 Jan 2022 16:54:36 +0000 (17:54 +0100)]
Fix spurious warning about variable referenced before assignment
Daniele Varrazzo [Sun, 2 Jan 2022 15:57:47 +0000 (16:57 +0100)]
Add flake8 configuration in other package dirs
Vim ALE is confused otherwise. I don't really get how is that it picks
the package directory as the starting one (maybe it finds the setup.py)?
Nikita Sobolev [Sun, 2 Jan 2022 11:51:11 +0000 (14:51 +0300)]
Change type of `wait` in `pool_async.py`
Will become an incompatible type in assignment with the release of
https://github.com/python/typeshed/pull/6783
Daniele Varrazzo [Sun, 2 Jan 2022 15:37:09 +0000 (16:37 +0100)]
Fix py_codecs data type
It doesn't contain str anymore since 3.0.4.
A stricter definition revealed a couple of wrong usages of the mapping.
Use more consistently the higher level `conninfo_encoding()` function
instead of directly the mapping.
Daniele Varrazzo [Sun, 2 Jan 2022 14:37:54 +0000 (15:37 +0100)]
Use conninfo encoding to encode errors on connection
PostgreSQL returns connection errors in the encoding specified in
lc_messages (e.g. EUC-JP for a server with `lc_messages=ja_JP.EUC-JP`).
However, because we don't have a connection, the message was decoded in
the fallback utf-8.
If the client has specified a client_encoding, use it to decode the
error message. Be more lenient than usual to look up the encoding
(because it is not normalised by the server and we don't care about
performance as this only happens on error handling). As for any other
error messages, still use an error=replace policy to avoid exploding
reporting an error in the wrong encoding.
Close #194.
Daniele Varrazzo [Wed, 29 Dec 2021 21:42:58 +0000 (22:42 +0100)]
Fix typo: a raw data -> raw data
Daniele Varrazzo [Wed, 29 Dec 2021 21:32:41 +0000 (22:32 +0100)]
Fix doc link to transactions management
Also, "transactions", not "transaction".
Daniele Varrazzo [Fri, 24 Dec 2021 07:59:31 +0000 (08:59 +0100)]
Add note about installing libpq via psql
Daniele Varrazzo [Thu, 23 Dec 2021 17:26:29 +0000 (18:26 +0100)]
Merge branch 'dependencies-bounds'
Daniele Varrazzo [Thu, 23 Dec 2021 15:34:49 +0000 (16:34 +0100)]
Add constraint file to test dependencies minimum version
Daniele Varrazzo [Thu, 23 Dec 2021 15:33:42 +0000 (16:33 +0100)]
Specify test/dev dependencies only at minor level
Where possible. pytest 6.2.5 is required by Python 3.10.
Daniele Varrazzo [Thu, 23 Dec 2021 15:32:41 +0000 (16:32 +0100)]
Specify lower bound for required backport packages
Daniele Varrazzo [Thu, 23 Dec 2021 01:54:05 +0000 (02:54 +0100)]
Remove upper bound from dependencies
Giving upper bounds to libraries creates problems if there are
transitive dependencies.
Our dependencies are only on dev/test time, but I'd rather get the
habit.
Daniele Varrazzo [Thu, 23 Dec 2021 01:36:43 +0000 (02:36 +0100)]
Schedule a daily test run and a weekly package run
This should help detecting breakages due to new depending packages. In
the future we may extend the tests to run on Python/Postgres master
branch too.
The intention is to remove the top bound from dependency packages,
because the practice is widely documented to be problematic. Thankfully
we have only dev/test dependencies, but I'd rather get the habit for
good.
This commit will be merged on master as it is because otherwise Github
won't pick the change.
Walter Doerwald [Wed, 22 Dec 2021 20:39:34 +0000 (21:39 +0100)]
Fix typos and grammar in documentation.
Daniele Varrazzo [Wed, 22 Dec 2021 19:46:51 +0000 (20:46 +0100)]
Avoid mypy version 0.930
The release is affected by the issues:
- https://github.com/python/mypy/issues/11820
- https://github.com/python/typeshed/issues/6661
already acknowledged as bugs.
Denis Laxalde [Tue, 21 Dec 2021 08:24:34 +0000 (09:24 +0100)]
Use mypy 0.920
One 'type: ignore' is no longer needed, it seems.
Daniele Varrazzo [Wed, 15 Dec 2021 00:24:28 +0000 (01:24 +0100)]
Reuse fixture across test module
The fixture is duplicated. Funnily enough, the dupe in async is less
efficient than the one in the sync test module, but it allowed to spot
the bug at the previous commit, after using it more than the prepared
threshold.
Ungratefully dropping it.
Daniele Varrazzo [Tue, 14 Dec 2021 23:57:11 +0000 (00:57 +0100)]
Fix prepared statements clearing
In the conditions illustrated by the test, i.e. with some statements
already prepared and a multiple statements query containing a DROP, the
check for multiple statements wouldn't have been triggered, and the
query would have eventually been asked for preparation, failing because
containing multiple statements.
Daniele Varrazzo [Tue, 14 Dec 2021 21:59:28 +0000 (22:59 +0100)]
Bump version to release 3.0.7
Daniele Varrazzo [Tue, 14 Dec 2021 21:45:22 +0000 (22:45 +0100)]
Fix Cursor.rowcount after an executemany hitting no result
Close #178
Daniele Varrazzo [Tue, 14 Dec 2021 21:42:18 +0000 (22:42 +0100)]
Fix executemany crash with empty input sequence
Close #179.
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.