]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
3 years agoPossibly use C impl of send() and fetch() in Cursor.stream() 91/head
Denis Laxalde [Sat, 2 Oct 2021 13:47:43 +0000 (15:47 +0200)] 
Possibly use C impl of send() and fetch() in Cursor.stream()

Taking advantage of these functions being available per previous commit.

3 years agoExtract send(), fetch_many() and fetch() from generators.execute() C impl
Denis Laxalde [Wed, 29 Sep 2021 12:09:29 +0000 (14:09 +0200)] 
Extract send(), fetch_many() and fetch() from generators.execute() C impl

We extract send(), fetch_many() and fetch() functions from execute() C
implementation. This way, the code structure is similar to the Python
implementation.

3 years agoRun mypy on pool/c Python files too
Daniele Varrazzo [Mon, 4 Oct 2021 16:33:28 +0000 (18:33 +0200)] 
Run mypy on pool/c Python files too

3 years agoExplicitly disallow some mypy checks for tests/
Denis Laxalde [Mon, 4 Oct 2021 09:20:55 +0000 (11:20 +0200)] 
Explicitly disallow some mypy checks for tests/

When running mypy on the tests/ directory, the top-level mypy
configuration is used and strict mode is thus enforced whereas tests
code is not typed. As mypy might be run in people editors by default,
the current situation makes this uncomfortable.

By disabling obvious checks, we get a nicer developer experience. A more
straightforward option would be to set 'check_untyped_defs = False', but
this would prevent valid code to be checked, so the current proposal is
a trade-off.

3 years agoImprove TypeInfo docs
Daniele Varrazzo [Mon, 4 Oct 2021 12:46:27 +0000 (14:46 +0200)] 
Improve TypeInfo docs

3 years agoMerge branch 'multirange'
Daniele Varrazzo [Mon, 4 Oct 2021 12:46:15 +0000 (14:46 +0200)] 
Merge branch 'multirange'

3 years agoAdd Multirange documentation
Daniele Varrazzo [Mon, 4 Oct 2021 12:43:15 +0000 (14:43 +0200)] 
Add Multirange documentation

3 years agoComplete multirange implementation and test
Daniele Varrazzo [Mon, 4 Oct 2021 01:50:15 +0000 (03:50 +0200)] 
Complete multirange implementation and test

- add register_multirange()
- check type of multirange items
- add extensive dump/load tests

3 years agoAdd total ordering on Multirange object
Daniele Varrazzo [Sun, 3 Oct 2021 23:53:18 +0000 (01:53 +0200)] 
Add total ordering on Multirange object

Also improved idiom for the Range ordering implementation.

3 years agoAdd random multirange tests
Daniele Varrazzo [Sat, 2 Oct 2021 17:28:19 +0000 (19:28 +0200)] 
Add random multirange tests

3 years agoAdd multirange adaptation
Daniele Varrazzo [Sat, 2 Oct 2021 03:31:23 +0000 (05:31 +0200)] 
Add multirange adaptation

To be tested yet

Close #75

3 years agoRefactor range adapters to make dumper and loader functions reusable
Daniele Varrazzo [Sat, 2 Oct 2021 01:48:34 +0000 (03:48 +0200)] 
Refactor range adapters to make dumper and loader functions reusable

3 years agoPrint the unexpected warnings in tests
Daniele Varrazzo [Sat, 2 Oct 2021 19:23:51 +0000 (21:23 +0200)] 
Print the unexpected warnings in tests

3 years agoMore compact parametrisation of range tests
Daniele Varrazzo [Sat, 2 Oct 2021 03:30:01 +0000 (05:30 +0200)] 
More compact parametrisation of range tests

3 years agoDisable creation of empty ranges in random tests
Daniele Varrazzo [Sat, 2 Oct 2021 17:47:43 +0000 (19:47 +0200)] 
Disable creation of empty ranges in random tests

If one end up as the first item in a list the array dumping the array
will fail. There are xfail tests in test_range for it.

3 years agoFix range comparisons in random tests
Daniele Varrazzo [Sat, 2 Oct 2021 17:27:11 +0000 (19:27 +0200)] 
Fix range comparisons in random tests

3 years agoModify range bounds to make them consistent with inf bounds
Daniele Varrazzo [Sat, 2 Oct 2021 17:22:26 +0000 (19:22 +0200)] 
Modify range bounds to make them consistent with inf bounds

Without doing so, there could be a range '[,]' which would still be
reported as having not lower_inc or upper_inc.

3 years agoAllow to use the pg(ver) marker with the module pytestmark
Daniele Varrazzo [Sat, 2 Oct 2021 03:29:25 +0000 (05:29 +0200)] 
Allow to use the pg(ver) marker with the module pytestmark

3 years agoAdd missing ExecStatusType enum values for pipeline mode
Denis Laxalde [Sat, 2 Oct 2021 16:57:21 +0000 (18:57 +0200)] 
Add missing ExecStatusType enum values for pipeline mode

Follow-up 515e246b5f933ba93fdde93a03287c6940dbf85b; these values were
only added for the Python definition of the enum.

3 years agoMerge pull request #89 from dlax/pipeline
Daniele Varrazzo [Fri, 1 Oct 2021 16:27:59 +0000 (17:27 +0100)] 
Merge pull request #89 from dlax/pipeline

add libpq interface for pipeline mode

3 years agoUse now available "postgres:14" Docker image in CI 89/head
Denis Laxalde [Fri, 1 Oct 2021 14:43:17 +0000 (16:43 +0200)] 
Use now available "postgres:14" Docker image in CI

3 years agoInstall libpq 14 in for some tests CI jobs
Denis Laxalde [Wed, 29 Sep 2021 07:42:51 +0000 (09:42 +0200)] 
Install libpq 14 in for some tests CI jobs

We add "libpq" matrix axis and select version 14 against various server
versions.

3 years agoAdd libpq interface for pipeline mode
Denis Laxalde [Tue, 22 Jun 2021 14:07:47 +0000 (16:07 +0200)] 
Add libpq interface for pipeline mode

Bindings are conditional so that compilation works with libpq version
older than 14.

Add a couple of tests inspired by PostgreSQL's tests.

3 years agoMerge branch 'python-3.10'
Daniele Varrazzo [Thu, 30 Sep 2021 19:14:14 +0000 (21:14 +0200)] 
Merge branch 'python-3.10'

3 years agoDocument Python 3.10 supported
Daniele Varrazzo [Thu, 30 Sep 2021 19:02:26 +0000 (21:02 +0200)] 
Document Python 3.10 supported

3 years agoBuild Python 3.10 packages
Daniele Varrazzo [Thu, 30 Sep 2021 19:02:11 +0000 (21:02 +0200)] 
Build Python 3.10 packages

3 years agoTest with Python 3.10
Daniele Varrazzo [Thu, 30 Sep 2021 19:01:41 +0000 (21:01 +0200)] 
Test with Python 3.10

3 years agoUpgrade testing dependencies
Daniele Varrazzo [Thu, 30 Sep 2021 18:59:35 +0000 (20:59 +0200)] 
Upgrade testing dependencies

Some are required for Python 3.10

3 years agoUpgrade flake to 3.9
Daniele Varrazzo [Thu, 30 Sep 2021 18:58:43 +0000 (20:58 +0200)] 
Upgrade flake to 3.9

This version reports an error if a name is declared but not defined, so
set the lazy imported objects to None and deal with mypy complaining.

3 years agoImprove test workflow
Daniele Varrazzo [Thu, 30 Sep 2021 12:51:24 +0000 (14:51 +0200)] 
Improve test workflow

- Quote Python version number because 3.10 will cause issue as number
- Use 'postgres' instead of 'image'
- Add vim folds

3 years agoWork around new delocation failure on Windows
Daniele Varrazzo [Thu, 30 Sep 2021 10:56:23 +0000 (12:56 +0200)] 
Work around new delocation failure on Windows

https://github.com/psycopg/psycopg/runs/3754213309?check_suite_focus=true

Not sure this is the right thing to do, if we are pulling in the right
dll.

3 years agoMerge branch 'postgres-14'
Daniele Varrazzo [Thu, 30 Sep 2021 09:21:56 +0000 (11:21 +0200)] 
Merge branch 'postgres-14'

3 years agoAdd supported systems in the docs
Daniele Varrazzo [Thu, 30 Sep 2021 09:21:33 +0000 (11:21 +0200)] 
Add supported systems in the docs

3 years agoAdd info about multirange types
Daniele Varrazzo [Thu, 30 Sep 2021 00:56:41 +0000 (00:56 +0000)] 
Add info about multirange types

3 years agoReplace 'TypesRegistry.get_range()' with more generic 'get_by_subtipe()'
Daniele Varrazzo [Thu, 30 Sep 2021 00:55:23 +0000 (00:55 +0000)] 
Replace 'TypesRegistry.get_range()' with more generic 'get_by_subtipe()'

3 years agoSimplify the types registry using a single map
Daniele Varrazzo [Wed, 29 Sep 2021 20:01:31 +0000 (20:01 +0000)] 
Simplify the types registry using a single map

3 years agoAllow PSYCOPG_TEST_DSN to be an empty string
Daniele Varrazzo [Wed, 29 Sep 2021 19:20:31 +0000 (19:20 +0000)] 
Allow PSYCOPG_TEST_DSN to be an empty string

This allows to configure the test database by only using the PG* env
vars, while still leaving the option to wreck a database opt-in.

3 years agoAdd PostgreSQL 14 to the test grid
Daniele Varrazzo [Wed, 29 Sep 2021 19:05:13 +0000 (21:05 +0200)] 
Add PostgreSQL 14 to the test grid

3 years agoAdjust test on PGconn.tty for libpq 14
Denis Laxalde [Wed, 29 Sep 2021 08:36:23 +0000 (10:36 +0200)] 
Adjust test on PGconn.tty for libpq 14

Quoting https://www.postgresql.org/docs/14/libpq-status.html:

  [PQtty] no longer does anything, but it remains for backwards
  compatibility. The function always return an empty string.

Or perhaps we should drop 'tty' property (and binding), since this is at
least obsolete since PostgreSQL 7.4?

3 years agoDocument that the ProactorEventLoop is incompatible with Psycopg
Daniele Varrazzo [Tue, 28 Sep 2021 20:35:52 +0000 (22:35 +0200)] 
Document that the ProactorEventLoop is incompatible with Psycopg

3 years agoImprove error message if proactor event loop is used on Windows
Daniele Varrazzo [Tue, 28 Sep 2021 20:14:28 +0000 (22:14 +0200)] 
Improve error message if proactor event loop is used on Windows

3 years agoMerge pull request #84 from CaselIT/asyncio_and_windows
Daniele Varrazzo [Tue, 28 Sep 2021 19:59:13 +0000 (20:59 +0100)] 
Merge pull request #84 from CaselIT/asyncio_and_windows

Improve async story in the test on windows

3 years agoSupport py36, test exception 84/head
Federico Caselli [Mon, 27 Sep 2021 20:39:31 +0000 (22:39 +0200)] 
Support py36, test exception

3 years agoRequire selector event loop on windows; enable aync tests
Federico Caselli [Sun, 26 Sep 2021 19:53:22 +0000 (21:53 +0200)] 
Require selector event loop on windows; enable aync tests

Fixes #76

3 years agoFix doc for Notify
Daniele Varrazzo [Mon, 27 Sep 2021 09:23:26 +0000 (11:23 +0200)] 
Fix doc for Notify

Probably autoclass is confused by the class module being changed.

3 years agoPrint a log instead of a warning on swallowed exit exception
Daniele Varrazzo [Mon, 27 Sep 2021 00:01:30 +0000 (02:01 +0200)] 
Print a log instead of a warning on swallowed exit exception

3 years agoDrop TODO points covered by the _dns module
Daniele Varrazzo [Sun, 26 Sep 2021 23:33:16 +0000 (01:33 +0200)] 
Drop TODO points covered by the _dns module

3 years agoMerge branch 'no-connection-encoding'
Daniele Varrazzo [Sun, 26 Sep 2021 23:37:02 +0000 (01:37 +0200)] 
Merge branch 'no-connection-encoding'

3 years agoDocument that client_encoding is gone
Daniele Varrazzo [Sun, 26 Sep 2021 23:26:59 +0000 (01:26 +0200)] 
Document that client_encoding is gone

3 years agoDrop Connection.client_encoding attribute
Daniele Varrazzo [Fri, 14 May 2021 22:24:24 +0000 (00:24 +0200)] 
Drop Connection.client_encoding attribute

Expose it as `Connection.info.encoding`, but use pgconn_encoding()
internally.

3 years agoAdd Cursor._pgconn internal property
Daniele Varrazzo [Fri, 14 May 2021 21:55:31 +0000 (23:55 +0200)] 
Add Cursor._pgconn internal property

3 years agoMake encodings module private
Daniele Varrazzo [Fri, 14 May 2021 21:30:54 +0000 (23:30 +0200)] 
Make encodings module private

3 years agoDrop connection.set_client_encoding
Daniele Varrazzo [Fri, 14 May 2021 21:11:50 +0000 (23:11 +0200)] 
Drop connection.set_client_encoding

The property might have been super useful in pre-unicode times, but now
it is really an implementation detail.

The connection encoding can be still changed setting the GUC or with a
PGOPTION or option in the connection params.

3 years agoFix beta release number to normalised form... again!
Daniele Varrazzo [Sun, 26 Sep 2021 22:08:10 +0000 (00:08 +0200)] 
Fix beta release number to normalised form... again!

I seem unable to learn what that form is.

3 years agoDrop "installing from source" from readme and install docs cleanup
Daniele Varrazzo [Sun, 26 Sep 2021 21:08:11 +0000 (23:08 +0200)] 
Drop "installing from source" from readme and install docs cleanup

3 years agoMerge branch 'fix-dumping-by-oid'
Daniele Varrazzo [Sun, 26 Sep 2021 20:31:33 +0000 (22:31 +0200)] 
Merge branch 'fix-dumping-by-oid'

3 years agoNote fix of dumping by oid in news file
Daniele Varrazzo [Sun, 26 Sep 2021 20:02:22 +0000 (22:02 +0200)] 
Note fix of dumping by oid in news file

3 years agoImprove AdaptersMap and Copy.set_types() docs
Daniele Varrazzo [Sun, 26 Sep 2021 20:18:54 +0000 (22:18 +0200)] 
Improve AdaptersMap and Copy.set_types() docs

3 years agoFix BytesDumper return type annotation
Daniele Varrazzo [Sun, 26 Sep 2021 19:47:06 +0000 (21:47 +0200)] 
Fix BytesDumper return type annotation

3 years agoAdd C version of numeric dumpers by oid too
Daniele Varrazzo [Thu, 23 Sep 2021 14:28:12 +0000 (16:28 +0200)] 
Add C version of numeric dumpers by oid too

3 years agoBetter wording: writing to attribute -> setting the attribute
Daniele Varrazzo [Sun, 26 Sep 2021 19:02:22 +0000 (21:02 +0200)] 
Better wording: writing to attribute -> setting the attribute

3 years agoFix selection of dumper by oid
Daniele Varrazzo [Thu, 23 Sep 2021 14:22:26 +0000 (16:22 +0200)] 
Fix selection of dumper by oid

Add a few dumpers which can deal with the different types and make sure
to register them so that the lookup by oid would use them. Because they
are slightly less efficient (with isinstance tests) we prefer to have
them only used by oid, instead of extending the domain of the dumpers
used in normal adaptation by type.

This commit only fixes the Python side. The C numeric dumpers require
more work.

3 years agoUse natural iteration over pq.Format in parametrised tests
Daniele Varrazzo [Thu, 23 Sep 2021 14:30:16 +0000 (16:30 +0200)] 
Use natural iteration over pq.Format in parametrised tests

3 years agoBetter tests of dumping after set_types
Daniele Varrazzo [Sun, 26 Sep 2021 19:41:08 +0000 (21:41 +0200)] 
Better tests of dumping after set_types

These tests reveal that When there is a 1-n mapping between oid and
python classes, we might pick a dumper that cannot really deal with the
object to dump (for instance trying to dump an int to numeric with the
Decimal dumper).

3 years agoAdd news file to the docs
Daniele Varrazzo [Sun, 26 Sep 2021 18:32:36 +0000 (20:32 +0200)] 
Add news file to the docs

3 years agoAllow to specify a custom adapt context on connect
Daniele Varrazzo [Thu, 23 Sep 2021 15:23:39 +0000 (17:23 +0200)] 
Allow to specify a custom adapt context on connect

Close #83

3 years agoFix beta release number to normalised form
Daniele Varrazzo [Fri, 24 Sep 2021 15:36:22 +0000 (17:36 +0200)] 
Fix beta release number to normalised form

3 years agoFix partially written comment
Daniele Varrazzo [Thu, 23 Sep 2021 01:59:19 +0000 (03:59 +0200)] 
Fix partially written comment

The issue was addressed before the comment could be written in all its ugliness.

3 years agoClear the prepared statements if the catalog might have changed
Daniele Varrazzo [Wed, 22 Sep 2021 20:10:09 +0000 (22:10 +0200)] 
Clear the prepared statements if the catalog might have changed

This could happen on DROP (and re-creation) of some object or on the
implicit drop caused by a rollback.

Issues happen if a prepared transaction is executed after an object has
been dropped: see
https://github.com/sqlalchemy/sqlalchemy/issues/6842#issuecomment-925131836

Postgres devs suggestion is to avoid to do that: see
https://www.postgresql.org/message-id/2220999.1632335261%40sss.pgh.pa.us

3 years agoImprove range random testing
Daniele Varrazzo [Thu, 23 Sep 2021 01:15:52 +0000 (03:15 +0200)] 
Improve range random testing

Make sure to create a numrange[] field instead of text, which would have
happened if the random selection in Faker.types_names() had picked an
array whose first object is an empty range.

Also extend the tests to certain binary range types which previously
couldn't be managed.

3 years agoFix a couple of imports as relative
Daniele Varrazzo [Fri, 14 May 2021 21:18:38 +0000 (23:18 +0200)] 
Fix a couple of imports as relative

3 years agoSpecify better that registering adapters only affects new object
Daniele Varrazzo [Wed, 22 Sep 2021 13:55:19 +0000 (15:55 +0200)] 
Specify better that registering adapters only affects new object

It is unclear that registering adapters globally doesn't affect existing
connections, including the one used to fetch info... See
https://github.com/sqlalchemy/sqlalchemy/issues/6842#issuecomment-924425360
for instance.

3 years agoImprove pq.version() doc
Daniele Varrazzo [Tue, 21 Sep 2021 19:01:48 +0000 (20:01 +0100)] 
Improve pq.version() doc

3 years agoExpose the libpq build version as psycopg.pq.__build_version__
Daniele Varrazzo [Tue, 21 Sep 2021 18:54:24 +0000 (19:54 +0100)] 
Expose the libpq build version as psycopg.pq.__build_version__

3 years agoMerge branch 'add-shapely-adapters'
Daniele Varrazzo [Tue, 21 Sep 2021 18:27:41 +0000 (19:27 +0100)] 
Merge branch 'add-shapely-adapters'

3 years agoUse class instead of type to create shapely dumpers
Daniele Varrazzo [Tue, 21 Sep 2021 16:09:23 +0000 (17:09 +0100)] 
Use class instead of type to create shapely dumpers

3 years agoReport a friendly message if the geometry info is not available
Daniele Varrazzo [Tue, 21 Sep 2021 15:54:14 +0000 (16:54 +0100)] 
Report a friendly message if the geometry info is not available

3 years agoCreate postgis extension if needed by tests, shapely tests cleanup
Daniele Varrazzo [Tue, 21 Sep 2021 15:32:01 +0000 (16:32 +0100)] 
Create postgis extension if needed by tests, shapely tests cleanup

3 years agoMove shapely test to the types package
Daniele Varrazzo [Tue, 21 Sep 2021 15:24:32 +0000 (16:24 +0100)] 
Move shapely test to the types package

3 years agoShapely docs cleanup
Daniele Varrazzo [Tue, 21 Sep 2021 15:19:17 +0000 (16:19 +0100)] 
Shapely docs cleanup

3 years agoFix test MultiPolygon geometry, add test for it
Jacopo Farina [Mon, 20 Sep 2021 12:57:30 +0000 (14:57 +0200)] 
Fix test MultiPolygon geometry, add test for it

3 years agoPass test geoJSON as parameter, not with string interpolation
Jacopo Farina [Thu, 16 Sep 2021 12:45:48 +0000 (14:45 +0200)] 
Pass test geoJSON as parameter, not with string interpolation

3 years agoParametrize input format too
Jacopo Farina [Thu, 16 Sep 2021 09:19:35 +0000 (11:19 +0200)] 
Parametrize input format too

3 years agoFix shapely documentation
Daniele Varrazzo [Sun, 12 Sep 2021 22:00:22 +0000 (00:00 +0200)] 
Fix shapely documentation

3 years agoForce different placeholder to increase the coverage
Jacopo Farina [Wed, 15 Sep 2021 14:28:35 +0000 (16:28 +0200)] 
Force different placeholder to increase the coverage

3 years agoImport modules for shapely test only at runtime
Jacopo Farina [Wed, 15 Sep 2021 13:55:32 +0000 (15:55 +0200)] 
Import modules for shapely test only at runtime

3 years agoAdd tests for the Shapely adapter based on PostGIS
Jacopo Farina [Wed, 15 Sep 2021 13:38:25 +0000 (15:38 +0200)] 
Add tests for the Shapely adapter based on PostGIS

3 years agoMake binary dumper the default one
Jacopo Farina [Wed, 15 Sep 2021 11:17:23 +0000 (13:17 +0200)] 
Make binary dumper the default one

The latest registered dumper is the one used by default if the %s
placeholder is used in a query. The binary one is preferred.

3 years agoRename module from types.geometry to types.shapely
Jacopo Farina [Wed, 15 Sep 2021 11:10:22 +0000 (13:10 +0200)] 
Rename module from types.geometry to types.shapely

In case in the future further adapters for geometry types are added,
this naming makes more sense

3 years agoHandle memoriview and buffer data as well as bytes, better import
Jacopo Farina [Tue, 14 Sep 2021 09:24:13 +0000 (11:24 +0200)] 
Handle memoriview and buffer data as well as bytes, better import

3 years agoAdd Shapely-based adapter for PostGIS geometry, and docs
Jacopo Farina [Tue, 14 Sep 2021 09:14:26 +0000 (11:14 +0200)] 
Add Shapely-based adapter for PostGIS geometry, and docs

Previous commits were messy due to some rebase gone wrong, moved them to
a single commit

3 years agoUse class instead of type() to create the specific hstore dumper
Daniele Varrazzo [Tue, 21 Sep 2021 16:03:52 +0000 (17:03 +0100)] 
Use class instead of type() to create the specific hstore dumper

The name is not variable so it's not useful to use the less common
constructor.

3 years agoRaise a friendly exception if None is passed to register_*()
Daniele Varrazzo [Tue, 21 Sep 2021 15:55:52 +0000 (16:55 +0100)] 
Raise a friendly exception if None is passed to register_*()

The most likely cause is fetching info and the object is not found.
Suggest that that's what happened instead of throwing an AttributeError
or anything else random.

3 years agoFix missing assert in test
Daniele Varrazzo [Tue, 21 Sep 2021 14:53:08 +0000 (15:53 +0100)] 
Fix missing assert in test

Add acopy() helper to write async tests more similar to sync ones

3 years agoDo not use the extended protocol in COPY
Daniele Varrazzo [Fri, 3 Sep 2021 16:39:09 +0000 (18:39 +0200)] 
Do not use the extended protocol in COPY

Error recovery is reported to be problematic (see #78).

Close #82.

3 years agoDrop rename of PyFormat import in tests
Daniele Varrazzo [Wed, 15 Sep 2021 18:19:26 +0000 (19:19 +0100)] 
Drop rename of PyFormat import in tests

It was to minimise a diff when it got renamed, but it's confusing using
old tests as template for new ones.

3 years agoChange macOS name in installation documentation
Artur Dryomov [Tue, 14 Sep 2021 09:37:55 +0000 (12:37 +0300)] 
Change macOS name in installation documentation

3 years agoFix docs case typo
Daniele Varrazzo [Mon, 13 Sep 2021 21:07:03 +0000 (23:07 +0200)] 
Fix docs case typo

3 years agoSmall adjustments suggested by pyupgrade
Daniele Varrazzo [Mon, 13 Sep 2021 15:56:50 +0000 (17:56 +0200)] 
Small adjustments suggested by pyupgrade

3 years agoDon't pass "utf8" to str.encode() and bytes.decode()
Daniele Varrazzo [Sun, 12 Sep 2021 22:25:57 +0000 (00:25 +0200)] 
Don't pass "utf8" to str.encode() and bytes.decode()

"utf8" is the default: not passing it is marginally faster.