]>
git.ipfire.org Git - thirdparty/psycopg.git/log
Daniele Varrazzo [Wed, 2 Nov 2022 10:21:21 +0000 (11:21 +0100)]
fix(c): drop duplicate PQconsumeInput call
Also add a couple of C types in the function for better C code.
Daniele Varrazzo [Fri, 4 Nov 2022 15:47:08 +0000 (16:47 +0100)]
fix: use a correct recursive definition for DumperKey
Already supported in current Mypy: https://github.com/python/mypy/issues/731.
The definition of DumperKey was wrong anyway, in a way causing mypy to
crash: see https://github.com/python/mypy/issues/14000.
Daniele Varrazzo [Fri, 4 Nov 2022 01:12:01 +0000 (02:12 +0100)]
lint: fix type hints with disabled bytearray/memoryview/bytes equivalience
This changeset makes the code compatible with the current Mypy 0.981,
but passes most of the checks that Mypy 0.990 enforces if the byte
strings equivalence is disabled.
Daniele Varrazzo [Thu, 3 Nov 2022 23:53:20 +0000 (00:53 +0100)]
fix: define Escaping method as returning bytes
This change is backward compatible because bytes has a superset of the
memoryview interface and, in Python, to make pretty much any use of it,
it must be converted to bytes beforehand.
Close #422.
Daniele Varrazzo [Thu, 3 Nov 2022 23:09:29 +0000 (00:09 +0100)]
fix: fix check for empty notice handlers list
Issue reported by Mypy 0.990. Thank you!
Daniele Varrazzo [Thu, 3 Nov 2022 19:27:00 +0000 (20:27 +0100)]
docs: use consistenty `!this` to represent parameters and non-linked code
Don't use *this*, which is more of a math use but it disagrees with the
style rendered on the docs, and don't use ``this``, left to literals.
Daniele Varrazzo [Tue, 25 Oct 2022 23:25:34 +0000 (01:25 +0200)]
perf(c): only use __cinit__ in adaptation classes
There is less overhead creating the objects.
Daniele Varrazzo [Wed, 19 Oct 2022 15:55:33 +0000 (16:55 +0100)]
perf: avoid lookups of Wait and Ready enum values
Daniele Varrazzo [Wed, 26 Oct 2022 01:07:28 +0000 (03:07 +0200)]
docs: document how to unbreak editable mode in the readme
Daniele Varrazzo [Thu, 27 Oct 2022 00:08:28 +0000 (02:08 +0200)]
chore: bump to next dev version
Daniele Varrazzo [Wed, 26 Oct 2022 23:59:24 +0000 (01:59 +0200)]
docs: typographic love to the 2to3 page
Daniele Varrazzo [Wed, 26 Oct 2022 23:58:04 +0000 (01:58 +0200)]
docs: add section about returning multiple results
Close #417.
Daniele Varrazzo [Wed, 26 Oct 2022 23:01:10 +0000 (01:01 +0200)]
Merge branch 'build-macos-py311'
Daniele Varrazzo [Wed, 26 Oct 2022 23:00:38 +0000 (01:00 +0200)]
ci: re-enable suspended job after building the missing image
Daniele Varrazzo [Wed, 26 Oct 2022 22:49:04 +0000 (00:49 +0200)]
ci: configure in order to build only Python 3.11 packages for macOS x86_64
The required image was not available at the time of building other
packages. See #424.
Daniele Varrazzo [Tue, 25 Oct 2022 18:02:28 +0000 (20:02 +0200)]
chore: bump psycopg-pool version to 3.1.3
Daniele Varrazzo [Tue, 25 Oct 2022 17:50:20 +0000 (19:50 +0200)]
chore: bump to version number 3.1.4
Daniele Varrazzo [Tue, 25 Oct 2022 14:58:23 +0000 (16:58 +0200)]
chore: upgrade binary dependencies to libpq 15.0, openssl 1.1.1r
Daniele Varrazzo [Tue, 25 Oct 2022 17:43:18 +0000 (19:43 +0200)]
Merge branch 'py311'
Daniele Varrazzo [Tue, 25 Oct 2022 14:55:24 +0000 (16:55 +0200)]
ci: build Python 3.11 macOS arm64 packages
Daniele Varrazzo [Tue, 25 Oct 2022 14:39:06 +0000 (16:39 +0200)]
ci: skip test/build on macOS x86_64 for Python 3.11
Package not available yet. See #424
Daniele Varrazzo [Thu, 8 Sep 2022 13:34:45 +0000 (14:34 +0100)]
docs: mention Python 3.11 support in news
Daniele Varrazzo [Thu, 8 Sep 2022 13:00:59 +0000 (14:00 +0100)]
ci: build packages for Python 3.11 too
Daniele Varrazzo [Sun, 15 May 2022 17:05:20 +0000 (19:05 +0200)]
chore: add Python 3.11 support metadata
Daniele Varrazzo [Sun, 15 May 2022 16:10:24 +0000 (18:10 +0200)]
chore: test with Python 3.11 rc1
Daniele Varrazzo [Sun, 15 May 2022 17:05:39 +0000 (19:05 +0200)]
chore: upgrade Cython to 3.0a11 to support Python 3.11
Daniele Varrazzo [Tue, 25 Oct 2022 12:29:59 +0000 (14:29 +0200)]
chore: upgrade actions/upload-artifact version
Daniele Varrazzo [Thu, 20 Oct 2022 21:45:48 +0000 (23:45 +0200)]
test: print out the file to delete in order to clear the segfault indicator
Daniele Varrazzo [Thu, 20 Oct 2022 21:04:18 +0000 (23:04 +0200)]
test: terminate the session early if connection to the test db fails
The error might be masked by other failures. It's also not useful to
receive the same message hundreds of times.
Daniele Varrazzo [Thu, 20 Oct 2022 19:21:51 +0000 (21:21 +0200)]
Merge branch 'pg15'
Daniele Varrazzo [Thu, 20 Oct 2022 02:31:03 +0000 (04:31 +0200)]
ci: Use Postgres 15 images and packages after official release
Daniele Varrazzo [Thu, 6 Oct 2022 01:55:24 +0000 (02:55 +0100)]
docs: declare PostgreSQL 15 supported
Daniele Varrazzo [Thu, 6 Oct 2022 01:47:46 +0000 (02:47 +0100)]
chore: add errors defined in PostgreSQL 15
Daniele Varrazzo [Mon, 22 Aug 2022 10:25:47 +0000 (12:25 +0200)]
test: include PostgreSQL RC 1 and libpq 15 in the tests
Daniele Varrazzo [Thu, 20 Oct 2022 02:24:18 +0000 (04:24 +0200)]
chore: upgrade github actions
The currently used ones raise deprecation warnings.
Denis Laxalde [Mon, 10 Oct 2022 15:26:38 +0000 (17:26 +0200)]
test: document --pq-trace and --pq-debug pytest option
Denis Laxalde [Thu, 6 Oct 2022 19:14:47 +0000 (21:14 +0200)]
test: add --pq-debug pytest option to use PGconnDebug
Denis Laxalde [Thu, 6 Oct 2022 14:41:05 +0000 (16:41 +0200)]
fix: lock the connection during all stream() lifetime
Namely, also lock the connection when closing the generator, in the
finally clause, where we are fetching results.
Denis Laxalde [Tue, 4 Oct 2022 19:41:22 +0000 (21:41 +0200)]
refactor: handle exit exception in BasePipeline._exit()
We remove repeated code in __(a)exit__() method of (Async)Pipeline by
passing the exception value to _exit() method of BasePipeline.
Daniele Varrazzo [Wed, 5 Oct 2022 11:09:02 +0000 (12:09 +0100)]
chore: bump version number to next dev release
Daniele Varrazzo [Tue, 4 Oct 2022 18:11:16 +0000 (19:11 +0100)]
Merge pull request #401 from dlax/pipeline-no-extra-begin
fix: sync pipeline after implicit BEGIN
Denis Laxalde [Tue, 4 Oct 2022 15:53:26 +0000 (17:53 +0200)]
fix: sync pipeline after implicit BEGIN
Prior to this change, the following code:
with conn.pipeline():
conn.execute("select 'x'").fetchone()
conn.execute("select 'y'")
would produce the following libpq trace:
F 13 Parse "" "BEGIN" 0
F 14 Bind "" "" 0 0 1 0
F 6 Describe P ""
F 9 Execute "" 0
F 18 Parse "" "select 'x'" 0
F 14 Bind "" "" 0 0 1 0
F 6 Describe P ""
F 9 Execute "" 0
F 4 Flush
B 4 ParseComplete
B 4 BindComplete
B 4 NoData
B 10 CommandComplete "BEGIN"
B 4 ParseComplete
B 4 BindComplete
B 33 RowDescription 1 "?column?" NNNN 0 NNNN 65535 -1 0
B 11 DataRow 1 1 'x'
B 13 CommandComplete "SELECT 1"
F 13 Parse "" "BEGIN" 0
F 14 Bind "" "" 0 0 1 0
F 6 Describe P ""
F 9 Execute "" 0
F 18 Parse "" "select 'y'" 0
F 14 Bind "" "" 0 0 1 0
F 6 Describe P ""
F 9 Execute "" 0
B 4 ParseComplete
B 4 BindComplete
B 4 NoData
B NN NoticeResponse S "WARNING" V "WARNING" C "25001" M "there is already a transaction in progress" F "SSSS" L "SSSS" R "SSSS" \x00
F 4 Sync
B 10 CommandComplete "BEGIN"
B 4 ParseComplete
B 4 BindComplete
B 33 RowDescription 1 "?column?" NNNN 0 NNNN 65535 -1 0
B 11 DataRow 1 1 'y'
B 13 CommandComplete "SELECT 1"
B 5 ReadyForQuery T
where we can see that the BEGIN statement (due to the connection being
in non-autocommit mode) is emitted twice, as notified by the server.
This is because the transaction state after the implicit BEGIN is not
"correct" (i.e. should be INTRANS, but is IDLE) since the result from
respective statement has not been received yet.
By syncing after the BEGIN, we fetch result from this command thus get
the transaction state INTRANS for following queries. This is similar to
what happens with explicit transaction, by using nested pipelines.
Daniele Varrazzo [Tue, 4 Oct 2022 16:43:27 +0000 (17:43 +0100)]
chore: bump to version number 3.1.3
Daniele Varrazzo [Tue, 4 Oct 2022 16:23:17 +0000 (17:23 +0100)]
Merge branch 'fix-399'
Daniele Varrazzo [Mon, 3 Oct 2022 23:28:07 +0000 (00:28 +0100)]
fix: fix handling of queries with %% in ClientCursor
Close #399.
Darren Ho [Sat, 1 Oct 2022 17:33:59 +0000 (18:33 +0100)]
#397: Fix typo in install.rst
Magnus Watn [Fri, 30 Sep 2022 13:44:28 +0000 (15:44 +0200)]
Remove warning about missing binary package for M1
Binary packages for Apple M1 was added in #162.
Daniele Varrazzo [Wed, 28 Sep 2022 18:25:08 +0000 (19:25 +0100)]
Merge branch 'stream-close'
Daniele Varrazzo [Wed, 21 Sep 2022 10:40:25 +0000 (11:40 +0100)]
fix: make sure to terminate query on gen.close() from Cursor.stream()
Fix #382
Daniele Varrazzo [Wed, 28 Sep 2022 01:01:52 +0000 (02:01 +0100)]
perf: use functools.cache where available
Faster than lru_cache; use it when we don't suppose we will ever evict
values.
Daniele Varrazzo [Wed, 28 Sep 2022 00:46:48 +0000 (01:46 +0100)]
Merge branch 'fix-escape-nametuple-field'
Daniele Varrazzo [Tue, 27 Sep 2022 08:54:49 +0000 (09:54 +0100)]
docs: mention named tuples regression fix in change log
Daniele Varrazzo [Tue, 27 Sep 2022 08:51:11 +0000 (09:51 +0100)]
test: more exhaustive test of difficult names/attrs in composites
Jolbas [Sun, 25 Sep 2022 14:11:36 +0000 (16:11 +0200)]
fix: restore pre-3.1 behaviour converting fields to named tuples attributes
Let more valid identifiers through _as_python_identifier(). Also 2.5x faster if no change is needed
Close #386
Jolbas [Sun, 25 Sep 2022 12:32:42 +0000 (14:32 +0200)]
test: check unusual column names and namedtuple
Daniele Varrazzo [Tue, 27 Sep 2022 08:15:21 +0000 (09:15 +0100)]
fix: avoid using type variables in typevar bounds
It is not allowed by the specs. Mypy tolerates it, replacing the
argument with Any, according to @erictraut. Pyright reports it as an
error instead.
See #365, microsoft/pyright#3984
Daniele Varrazzo [Wed, 28 Sep 2022 00:28:41 +0000 (01:28 +0100)]
chore: upgrade mypy to 0.981
Most changes needed by https://github.com/python/typeshed/pull/8446.
Daniele Varrazzo [Sun, 25 Sep 2022 01:41:52 +0000 (02:41 +0100)]
docs: fix plural
Daniele Varrazzo [Sun, 25 Sep 2022 01:39:29 +0000 (02:39 +0100)]
docs: mention macOS arm64 packages distribution
Daniele Varrazzo [Sun, 25 Sep 2022 01:31:22 +0000 (02:31 +0100)]
build: fix starting Postgres in macOS build script
The brew command fails with:
Could not enable service: 125: Domain does not support specified action
Error: Failure while executing; `/bin/launchctl enable gui/501/homebrew.mxcl.postgresql@14` exited with 125.
Daniele Varrazzo [Wed, 21 Sep 2022 11:49:25 +0000 (12:49 +0100)]
docs: typo messge -> message
Thank you, codespell 💀💀💀
Daniele Varrazzo [Wed, 21 Sep 2022 11:46:07 +0000 (12:46 +0100)]
docs: add link to document how to recover the stream from ACTIVE state
See #382.
Daniele Varrazzo [Mon, 19 Sep 2022 17:31:58 +0000 (18:31 +0100)]
chore: bump to next dev version number
Daniele Varrazzo [Mon, 19 Sep 2022 11:08:22 +0000 (12:08 +0100)]
chore: bump to version number 3.1.2
Daniele Varrazzo [Sun, 18 Sep 2022 21:45:48 +0000 (22:45 +0100)]
fix: fix queries with repeated named parameters in ClientCursor
Close #378.
Denis Laxalde [Thu, 15 Sep 2022 10:24:43 +0000 (12:24 +0200)]
test: allow to trace libpq to STDERR, rename option to --pq-trace
By using STDERR, we get the trace directly in pytest output for failing
tests. Though this requires care when used in combination with
--capture=sys because this would make sys.stderr an in-memory file.
When STDERR is used, we don't insert the header since the test case
identifier will be interleaved already.
Denis Laxalde [Thu, 15 Sep 2022 16:28:21 +0000 (18:28 +0200)]
fix: also sync nested pipeline when a transaction is active
Upon enter, transaction() checks the in-transaction status to determine
if a BEGIN (when IDLE) or a SAVEPOINT (otherwise) should be inserted.
However, in pipeline mode, if the pipeline is in "implicit transaction"
(i.e. it has no active BEGIN) and statements have been sent, the
in-transaction status might be ACTIVE if those statements have not yet
completed (typically, when results have not been fetched).
By issuing a sync() before entering a nested pipeline (which will happen
when entering transaction(), if already within a pipeline), we force
completion of those statements, and thus get a predictable
in-transaction status before entering the transaction() block.
Closes #374.
Daniele Varrazzo [Thu, 15 Sep 2022 01:07:57 +0000 (02:07 +0100)]
test: fail test session in case of segfault
Before that, tox reruns would have made tests pass, because failed tests
wouldn't have gotten a chance to be written in the cache.
Daniele Varrazzo [Wed, 14 Sep 2022 21:30:44 +0000 (22:30 +0100)]
Merge branch 'fix-372'
Daniele Varrazzo [Wed, 14 Sep 2022 21:02:38 +0000 (22:02 +0100)]
fix(psycopg_c): propagate exceptions in Transformer.set_pgresult()
Fix #372
Daniele Varrazzo [Wed, 14 Sep 2022 20:57:05 +0000 (21:57 +0100)]
test: add test to verify the behavior of adapters failing init
An exception in loader init doesn't get raised and causes a segfault.
This reproduces the issue in #372.
Daniele Varrazzo [Wed, 14 Sep 2022 14:17:55 +0000 (15:17 +0100)]
Merge branch 'docs/pgconn'
Denis Laxalde [Wed, 14 Sep 2022 12:20:05 +0000 (14:20 +0200)]
docs: document PGconn's tracing methods
Denis Laxalde [Wed, 14 Sep 2022 12:02:43 +0000 (14:02 +0200)]
docs: document PGconn.encrypt_password()
Including an example of usage.
Daniele Varrazzo [Wed, 14 Sep 2022 14:14:32 +0000 (15:14 +0100)]
refactor(psycopg_c): define loggers at module level
Daniele Varrazzo [Wed, 14 Sep 2022 13:40:41 +0000 (14:40 +0100)]
fix(psycopg_c): add missing logger declaration
Daniele Varrazzo [Wed, 14 Sep 2022 12:24:55 +0000 (13:24 +0100)]
Merge branch 'fix-371'
Daniele Varrazzo [Wed, 14 Sep 2022 11:59:14 +0000 (12:59 +0100)]
docs: mention Windows timezone problem fixed in change log
Daniele Varrazzo [Wed, 14 Sep 2022 11:50:05 +0000 (12:50 +0100)]
fix: catch any type of error if ZoneInfo creation fails
OSError would be enough to solve the problem reported in #371. However,
in case of error, Windows C implementation segfaults. I would prefer to
not chase this error just because of weirdness in the tzdata external
library, so let's cast a wider net.
Fix #371
Daniele Varrazzo [Wed, 14 Sep 2022 11:33:23 +0000 (12:33 +0100)]
test: add bad timezone to simulate a reported timezone issue
The bad timezone causes OSError on Windows.
See #371
Daniele Varrazzo [Thu, 8 Sep 2022 12:59:47 +0000 (13:59 +0100)]
chore(pool): bump to next dev version number
Daniele Varrazzo [Wed, 7 Sep 2022 11:01:04 +0000 (12:01 +0100)]
chore: bump psycopg-pool version to 3.1.2
Daniele Varrazzo [Wed, 7 Sep 2022 10:56:43 +0000 (11:56 +0100)]
Merge branch 'fix-370'
Daniele Varrazzo [Tue, 6 Sep 2022 23:49:14 +0000 (00:49 +0100)]
fix(pool): continue growing if the pool is not full yet
Previously, starting from an empty pool, we would have stopped at the
first connection created.
Daniele Varrazzo [Tue, 6 Sep 2022 16:53:40 +0000 (17:53 +0100)]
fix(pool): allow growing again after failing a growing connection attempt
Fix #370
Daniele Varrazzo [Tue, 6 Sep 2022 11:49:19 +0000 (12:49 +0100)]
chore: bump to next dev version number
Daniele Varrazzo [Mon, 5 Sep 2022 12:23:19 +0000 (13:23 +0100)]
chore: bump to version number 3.1.1
Daniele Varrazzo [Mon, 5 Sep 2022 12:21:37 +0000 (13:21 +0100)]
Merge branch 'macos-broken'
Daniele Varrazzo [Mon, 5 Sep 2022 11:28:05 +0000 (12:28 +0100)]
docs: add news entry about Homebrew fix
Daniele Varrazzo [Mon, 5 Sep 2022 11:09:33 +0000 (12:09 +0100)]
refactor: add find_libpq_full_path() to use both in library and tests
Daniele Varrazzo [Mon, 5 Sep 2022 09:56:06 +0000 (10:56 +0100)]
fix(macos): find the libpq in non-standard places
Daniele Varrazzo [Sat, 3 Sep 2022 18:24:52 +0000 (19:24 +0100)]
chore: upgrade QEMU to v2 for build
Also make sure to use a version not affected by bug #304
Daniele Varrazzo [Fri, 2 Sep 2022 15:30:23 +0000 (16:30 +0100)]
fix: make sure to pass a port number to getaddrinfo
Was passing an empty string by mistake, if no port was specified. Mostly
not a problem, except on some platforms, where it causes an
"unrecognized service" error.
Close #366.
Daniele Varrazzo [Fri, 2 Sep 2022 15:29:28 +0000 (16:29 +0100)]
Bump to next dev release
Daniele Varrazzo [Tue, 30 Aug 2022 22:46:46 +0000 (23:46 +0100)]
docs: fix title level in news
Daniele Varrazzo [Mon, 29 Aug 2022 23:01:14 +0000 (00:01 +0100)]
chore: bump version number to release 3.1
Daniele Varrazzo [Mon, 29 Aug 2022 22:52:03 +0000 (23:52 +0100)]
chore: bump to version 3.0.17
Daniele Varrazzo [Mon, 29 Aug 2022 08:58:57 +0000 (09:58 +0100)]
Merge branch 'crdb-ci'
Daniele Varrazzo [Sun, 28 Aug 2022 16:56:08 +0000 (17:56 +0100)]
ci: run CRDB tests in CI
Daniele Varrazzo [Mon, 29 Aug 2022 01:23:03 +0000 (02:23 +0100)]
test(crdb): consider Decimal("Infinity") not supported in CRDB < 22