]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
4 years agoRetry a few time-based pool tests
Daniele Varrazzo [Mon, 28 Jun 2021 18:38:00 +0000 (19:38 +0100)] 
Retry a few time-based pool tests

4 years agoFix tests run with libpq 9.6
Daniele Varrazzo [Mon, 28 Jun 2021 12:00:36 +0000 (13:00 +0100)] 
Fix tests run with libpq 9.6

4 years agoFix compatibility with 32 bit platforms
Daniele Varrazzo [Mon, 28 Jun 2021 04:31:10 +0000 (05:31 +0100)] 
Fix compatibility with 32 bit platforms

4 years agoUse the _psycopg module from either psycopg_c or psycopg_binary
Daniele Varrazzo [Mon, 28 Jun 2021 02:14:20 +0000 (03:14 +0100)] 
Use the _psycopg module from either psycopg_c or psycopg_binary

4 years agoFix test if the connection string specifies a password
Daniele Varrazzo [Mon, 28 Jun 2021 02:29:33 +0000 (03:29 +0100)] 
Fix test if the connection string specifies a password

4 years agoConfigure libpq libcrypto callback
Daniele Varrazzo [Sun, 27 Jun 2021 15:59:07 +0000 (16:59 +0100)] 
Configure libpq libcrypto callback

Import the ssl module beforehand and set up libpq callbacks to avoid clobbering
the former ones.

4 years agoMerge branch 'better-json'
Daniele Varrazzo [Sun, 27 Jun 2021 02:11:06 +0000 (03:11 +0100)] 
Merge branch 'better-json'

4 years agoUpdate json documentation to describe the new interfaces
Daniele Varrazzo [Sun, 27 Jun 2021 01:40:41 +0000 (02:40 +0100)] 
Update json documentation to describe the new interfaces

4 years agoAllow specifying a context to `set_json_loads/dumps()` functions
Daniele Varrazzo [Sun, 27 Jun 2021 00:51:28 +0000 (01:51 +0100)] 
Allow specifying a context to `set_json_loads/dumps()` functions

Drop subclasses tests from the test suite because they are an
implementation detail: the real interface are the `set_json_*()` functions.

4 years agoMore consistent inheritance graph of json dumpers
Daniele Varrazzo [Sun, 27 Jun 2021 00:23:30 +0000 (01:23 +0100)] 
More consistent inheritance graph of json dumpers

4 years agoCustomise json dumpers and loaders using a class attribute
Daniele Varrazzo [Sun, 27 Jun 2021 00:17:02 +0000 (01:17 +0100)] 
Customise json dumpers and loaders using a class attribute

This is an intermediary step: the class attribute can be set by
subclassing but the idea is to extend set_json_dumps/loads functions to
create these subclasses automatically.

4 years agoGive Json wrappers a dumps method
Daniele Varrazzo [Sat, 26 Jun 2021 23:36:35 +0000 (00:36 +0100)] 
Give Json wrappers a dumps method

In the previous model, dumping a specific json object with a specific
dumper was excessively difficult (it would have required subclassing a
wrapper and a dumper).

4 years agoPackage renamed to psycopg
Daniele Varrazzo [Sat, 26 Jun 2021 03:37:53 +0000 (04:37 +0100)] 
Package renamed to psycopg

Calling the package psycopg3 doesn't allow to apply semver.

4 years agoDefine the package_data info in the setup.cfg files
Daniele Varrazzo [Sat, 26 Jun 2021 02:37:35 +0000 (03:37 +0100)] 
Define the package_data info in the setup.cfg files

It wasn't working... because there was a typo.

Also fix inclusion of pxd files in the psycopg3_c sdist package: finding
them recursively doesn't work because the subdirectories are not
packages (and making them so, adding __init__.py files, breaks
everything) so specify all the paths where they are to be found.

4 years agoMerge branch 'types-reorg'
Daniele Varrazzo [Sat, 26 Jun 2021 02:11:27 +0000 (03:11 +0100)] 
Merge branch 'types-reorg'

4 years agoRename internal numeric adapter classes as private
Daniele Varrazzo [Sat, 26 Jun 2021 01:59:27 +0000 (02:59 +0100)] 
Rename internal numeric adapter classes as private

4 years agoUniform datetime dumpers names
Daniele Varrazzo [Sat, 26 Jun 2021 01:54:08 +0000 (02:54 +0100)] 
Uniform datetime dumpers names

4 years agoStringDumper renamed to StrDumper
Daniele Varrazzo [Sat, 26 Jun 2021 01:42:46 +0000 (02:42 +0100)] 
StringDumper renamed to StrDumper

4 years agoModule types.text renamed to string
Daniele Varrazzo [Sat, 26 Jun 2021 01:38:09 +0000 (02:38 +0100)] 
Module types.text renamed to string

4 years agoModule types.date renamed to datetime
Daniele Varrazzo [Sat, 26 Jun 2021 01:28:12 +0000 (02:28 +0100)] 
Module types.date renamed to datetime

4 years agoModule types.network renamed to net
Daniele Varrazzo [Sat, 26 Jun 2021 01:22:49 +0000 (02:22 +0100)] 
Module types.network renamed to net

4 years agoSplit types.singleton module into bool and none
Daniele Varrazzo [Sat, 26 Jun 2021 01:18:24 +0000 (02:18 +0100)] 
Split types.singleton module into bool and none

4 years agoDon't expose all the adapters in the types package
Daniele Varrazzo [Sat, 26 Jun 2021 00:59:35 +0000 (01:59 +0100)] 
Don't expose all the adapters in the types package

4 years agoStop using the psycopg3.types module as facade for all the types
Daniele Varrazzo [Fri, 25 Jun 2021 17:17:45 +0000 (18:17 +0100)] 
Stop using the psycopg3.types module as facade for all the types

Drop the psycopg3.wrappers package too and define the interface where to
take the wrapper to be psycopg3.types.MODULE

4 years agoMerge branch 'binary-range'
Daniele Varrazzo [Fri, 25 Jun 2021 16:54:19 +0000 (17:54 +0100)] 
Merge branch 'binary-range'

4 years agoMove basic struct-related functions to a common module
Daniele Varrazzo [Tue, 8 Jun 2021 18:24:39 +0000 (19:24 +0100)] 
Move basic struct-related functions to a common module

4 years agoUse type-specific range subclasses to avoid the dump upgrade mechanism
Daniele Varrazzo [Wed, 23 Jun 2021 16:04:09 +0000 (17:04 +0100)] 
Use type-specific range subclasses to avoid the dump upgrade mechanism

This allows binary dump of empty ranges, for which the type can be
inferred. In normal dumping these are dumped in text format with unknown
oid but that would break binary copy.

4 years agoDrop unneeded imports in types package
Daniele Varrazzo [Wed, 23 Jun 2021 12:30:24 +0000 (13:30 +0100)] 
Drop unneeded imports in types package

Probably they used to have side effects, overtaken by
register_default_globals().

4 years agoFix rounding error in float comparison tests with postgres < 12
Daniele Varrazzo [Wed, 23 Jun 2021 12:10:57 +0000 (13:10 +0100)] 
Fix rounding error in float comparison tests with postgres < 12

4 years agoAllow random testing with text format
Daniele Varrazzo [Tue, 22 Jun 2021 17:00:43 +0000 (18:00 +0100)] 
Allow random testing with text format

Ranges are a bit complicated because upgrading empty ones only works in
text mode. This should be addressed, but hopefully it only affects
binary copy for now.

4 years agoTest random range objects
Daniele Varrazzo [Wed, 9 Jun 2021 15:44:34 +0000 (16:44 +0100)] 
Test random range objects

4 years agoAdd range binary dumpers
Daniele Varrazzo [Wed, 9 Jun 2021 00:31:48 +0000 (01:31 +0100)] 
Add range binary dumpers

4 years agoAdd Range.bounds attribute
Daniele Varrazzo [Wed, 9 Jun 2021 15:43:05 +0000 (16:43 +0100)] 
Add Range.bounds attribute

4 years agoAdd RecursiveDumper, RecursiveLoader
Daniele Varrazzo [Tue, 8 Jun 2021 20:27:40 +0000 (21:27 +0100)] 
Add RecursiveDumper, RecursiveLoader

4 years agoAdd range binary loaders
Daniele Varrazzo [Tue, 8 Jun 2021 19:08:29 +0000 (20:08 +0100)] 
Add range binary loaders

4 years agoFix interval and timezone parsing in copy buffers
Daniele Varrazzo [Wed, 23 Jun 2021 11:45:03 +0000 (12:45 +0100)] 
Fix interval and timezone parsing in copy buffers

4 years agoMake tests.pq a module to allow relative import
Daniele Varrazzo [Tue, 22 Jun 2021 10:57:01 +0000 (11:57 +0100)] 
Make tests.pq a module to allow relative import

4 years agoMark timing based test flaky
Daniele Varrazzo [Tue, 22 Jun 2021 10:54:02 +0000 (11:54 +0100)] 
Mark timing based test flaky

4 years agoInsist more on the GC tests
Daniele Varrazzo [Tue, 22 Jun 2021 10:38:18 +0000 (11:38 +0100)] 
Insist more on the GC tests

4 years agoMerge branch 'sql-as-bytes'
Daniele Varrazzo [Tue, 22 Jun 2021 09:48:29 +0000 (10:48 +0100)] 
Merge branch 'sql-as-bytes'

4 years agoDrop TestSqlFormat::test_unicode
Denis Laxalde [Thu, 10 Jun 2021 11:56:06 +0000 (13:56 +0200)] 
Drop TestSqlFormat::test_unicode

The same is already checked in test_pos_spec() method.

4 years agoAuto-document Composable.as_bytes()
Denis Laxalde [Thu, 10 Jun 2021 11:52:28 +0000 (13:52 +0200)] 
Auto-document Composable.as_bytes()

4 years agoMake Composable an abstract base class
Denis Laxalde [Thu, 10 Jun 2021 11:27:05 +0000 (13:27 +0200)] 
Make Composable an abstract base class

4 years agoDrop inheritance from 'object' in sql module and tests
Denis Laxalde [Thu, 10 Jun 2021 11:24:10 +0000 (13:24 +0200)] 
Drop inheritance from 'object' in sql module and tests

4 years agoTrigger docs update to the website build workflow on GitHub Action
Daniele Varrazzo [Thu, 17 Jun 2021 12:31:32 +0000 (13:31 +0100)] 
Trigger docs update to the website build workflow on GitHub Action

4 years agoDon't require the virtualenv binary to build the docs
Daniele Varrazzo [Thu, 17 Jun 2021 00:44:53 +0000 (01:44 +0100)] 
Don't require the virtualenv binary to build the docs

4 years agoAdd missing return type annotation
Daniele Varrazzo [Mon, 14 Jun 2021 09:46:19 +0000 (10:46 +0100)] 
Add missing return type annotation

4 years agoFind the failing value when a random insert fails
Daniele Varrazzo [Mon, 14 Jun 2021 09:42:49 +0000 (10:42 +0100)] 
Find the failing value when a random insert fails

4 years agoFix float parsing when the data buffer is not terminated
Daniele Varrazzo [Thu, 10 Jun 2021 16:08:12 +0000 (17:08 +0100)] 
Fix float parsing when the data buffer is not terminated

4 years agoFix DB API Binary wrapper
Daniele Varrazzo [Thu, 10 Jun 2021 10:25:47 +0000 (11:25 +0100)] 
Fix DB API Binary wrapper

4 years agoConsider some tests flaky
Daniele Varrazzo [Thu, 10 Jun 2021 11:57:19 +0000 (12:57 +0100)] 
Consider some tests flaky

They fail regularly enough in the github workflow

4 years agoDrop timeout on workflow test step
Daniele Varrazzo [Thu, 10 Jun 2021 11:05:11 +0000 (12:05 +0100)] 
Drop timeout on workflow test step

4 years agoLonger test run timeout
Daniele Varrazzo [Wed, 9 Jun 2021 23:06:45 +0000 (00:06 +0100)] 
Longer test run timeout

4 years agoFix reveal_type tests to mypy 0.901 output format
Daniele Varrazzo [Wed, 9 Jun 2021 16:28:32 +0000 (17:28 +0100)] 
Fix reveal_type tests to mypy 0.901 output format

4 years agoBetter naming and typing for a couple of vars
Daniele Varrazzo [Tue, 8 Jun 2021 12:58:59 +0000 (13:58 +0100)] 
Better naming and typing for a couple of vars

Note that mypy has some issue there, so a "type: ignore" that seems
required cannot be actually added.

4 years agoMerge branch 'connect-timeout'
Daniele Varrazzo [Tue, 8 Jun 2021 16:09:40 +0000 (17:09 +0100)] 
Merge branch 'connect-timeout'

4 years agoRaise OperationalError for connection timeout
Denis Laxalde [Thu, 6 May 2021 06:42:08 +0000 (08:42 +0200)] 
Raise OperationalError for connection timeout

4 years agoAdd support for connection timeout
Denis Laxalde [Tue, 4 May 2021 15:36:33 +0000 (17:36 +0200)] 
Add support for connection timeout

In *Connection.connect(), we replace call to make_conninfo() by the new
_conninfo_connect_timeout() utility function which builds the 'conninfo'
string (using make_conninfo()) and extracts the 'connect_timeout'
parameter.

For the synchronous API, this timeout value is then handled to
waiting.wait_conn(), to be used in the select() call. There, if select()
does not return within timeout, we raise a DatabaseError.

For the asynchronous API, it is passed to waiting.wait_conn_async()
where we use asyncio.wait_for() to wait for the event and also raise a
DatabaseError in case of timeout.

4 years agoBuild conninfo in *Connection.connect()
Denis Laxalde [Wed, 5 May 2021 07:40:26 +0000 (09:40 +0200)] 
Build conninfo in *Connection.connect()

We'll need to extract 'connect_timeout' from the connection string and
use it outside Connection._connect_gen() in the next commit.

4 years agoMerge branch 'network-binary'
Daniele Varrazzo [Tue, 8 Jun 2021 10:41:17 +0000 (11:41 +0100)] 
Merge branch 'network-binary'

4 years agoGenerate random ipaddress objects for testing
Daniele Varrazzo [Tue, 8 Jun 2021 04:07:04 +0000 (05:07 +0100)] 
Generate random ipaddress objects for testing

4 years agoAdd network types binary loaders
Daniele Varrazzo [Tue, 8 Jun 2021 03:48:12 +0000 (04:48 +0100)] 
Add network types binary loaders

4 years agoAdd ipaddress binary dumpers
Daniele Varrazzo [Tue, 8 Jun 2021 03:15:34 +0000 (04:15 +0100)] 
Add ipaddress binary dumpers

4 years agoDrop utils sub-package
Daniele Varrazzo [Tue, 8 Jun 2021 01:42:43 +0000 (02:42 +0100)] 
Drop utils sub-package

4 years agoMerge branch 'c-datetime-adapters'
Daniele Varrazzo [Tue, 8 Jun 2021 01:32:26 +0000 (02:32 +0100)] 
Merge branch 'c-datetime-adapters'

4 years agoAdd C interval text loader
Daniele Varrazzo [Tue, 8 Jun 2021 01:00:43 +0000 (02:00 +0100)] 
Add C interval text loader

4 years agoAdd C interval binary loader
Daniele Varrazzo [Mon, 7 Jun 2021 22:37:11 +0000 (23:37 +0100)] 
Add C interval binary loader

4 years agoUse consistently 'us' instead of 'ms' for microseconds
Daniele Varrazzo [Mon, 7 Jun 2021 21:42:22 +0000 (22:42 +0100)] 
Use consistently 'us' instead of 'ms' for microseconds

4 years agoPad second fractions to micros using a lookup table
Daniele Varrazzo [Mon, 7 Jun 2021 20:44:00 +0000 (21:44 +0100)] 
Pad second fractions to micros using a lookup table

4 years agoAdd timestamptz c binary loader
Daniele Varrazzo [Mon, 7 Jun 2021 20:29:42 +0000 (21:29 +0100)] 
Add timestamptz c binary loader

4 years agoAdd timestamptz c text loader
Daniele Varrazzo [Sun, 6 Jun 2021 23:38:56 +0000 (00:38 +0100)] 
Add timestamptz c text loader

4 years agoDrop code duplication in date/time parsing
Daniele Varrazzo [Sun, 6 Jun 2021 23:25:20 +0000 (00:25 +0100)] 
Drop code duplication in date/time parsing

4 years agoAdd c timestamp binary loader
Daniele Varrazzo [Sun, 6 Jun 2021 21:31:33 +0000 (22:31 +0100)] 
Add c timestamp binary loader

4 years agoParse datetype without using endswith in c
Daniele Varrazzo [Sun, 6 Jun 2021 21:30:51 +0000 (22:30 +0100)] 
Parse datetype without using endswith in c

4 years agoAdd c text timestamp loader
Daniele Varrazzo [Wed, 2 Jun 2021 13:13:40 +0000 (14:13 +0100)] 
Add c text timestamp loader

4 years agoAdd c timetz binary loader
Daniele Varrazzo [Wed, 2 Jun 2021 10:42:12 +0000 (11:42 +0100)] 
Add c timetz binary loader

4 years agoAdd helper function to return timezone from second
Daniele Varrazzo [Wed, 2 Jun 2021 03:57:15 +0000 (04:57 +0100)] 
Add helper function to return timezone from second

Use a cache to return the same object for the same offset.

4 years agoAdd c text timetz loader
Daniele Varrazzo [Wed, 2 Jun 2021 03:28:07 +0000 (04:28 +0100)] 
Add c text timetz loader

4 years agoAdd c binary time loader
Daniele Varrazzo [Wed, 2 Jun 2021 02:44:48 +0000 (03:44 +0100)] 
Add c binary time loader

4 years agoAdd c text time loader
Daniele Varrazzo [Wed, 2 Jun 2021 02:27:44 +0000 (03:27 +0100)] 
Add c text time loader

4 years agoAdd c timedelta dumpers
Daniele Varrazzo [Wed, 2 Jun 2021 01:55:59 +0000 (02:55 +0100)] 
Add c timedelta dumpers

4 years agoAdd c datetime binary dumpers
Daniele Varrazzo [Wed, 2 Jun 2021 01:29:33 +0000 (02:29 +0100)] 
Add c datetime binary dumpers

4 years agoAdd c datetime text dumpers
Daniele Varrazzo [Wed, 2 Jun 2021 00:49:23 +0000 (01:49 +0100)] 
Add c datetime text dumpers

4 years agoRationalise date dumpers inheritance tree
Daniele Varrazzo [Wed, 2 Jun 2021 00:43:22 +0000 (01:43 +0100)] 
Rationalise date dumpers inheritance tree

4 years agoAdd C time dumpers
Daniele Varrazzo [Sun, 16 May 2021 22:46:50 +0000 (00:46 +0200)] 
Add C time dumpers

4 years agoSay "can't parse x", not "can't manage x"
Daniele Varrazzo [Sun, 16 May 2021 01:39:55 +0000 (03:39 +0200)] 
Say "can't parse x", not "can't manage x"

These are parsing error. Stuff we can't manage (e.g. year < 10K) is
complained of elsewhere

4 years agoUniform date/time loaders naming
Daniele Varrazzo [Sun, 16 May 2021 01:38:00 +0000 (03:38 +0200)] 
Uniform date/time loaders naming

Just use the type name with one uppercase, no camels here.

4 years agoComplete C date adapters, text and binary
Daniele Varrazzo [Sun, 16 May 2021 00:24:08 +0000 (02:24 +0200)] 
Complete C date adapters, text and binary

4 years agoAdd C date loader
Daniele Varrazzo [Sat, 15 May 2021 23:27:21 +0000 (01:27 +0200)] 
Add C date loader

8x faster than the Python loader

4 years agoRaise multi-line error messages with context
Daniele Varrazzo [Tue, 1 Jun 2021 23:03:44 +0000 (00:03 +0100)] 
Raise multi-line error messages with context

The context is not available in the diag error. Debugging without it is
pretty hard.

Make sure the error doesn't end with a newline, which is a complaint of
psycopg2.

4 years agoDrop floating point dumping of datetime objects
Daniele Varrazzo [Sun, 16 May 2021 07:33:44 +0000 (09:33 +0200)] 
Drop floating point dumping of datetime objects

The random test found rounding errors around year 2034.

4 years agoMerge branch 'tzinfo'
Daniele Varrazzo [Sun, 16 May 2021 00:52:50 +0000 (02:52 +0200)] 
Merge branch 'tzinfo'

4 years agoStreamline fixed size dumpers by dumping directly in the output buffer
Daniele Varrazzo [Sun, 16 May 2021 00:26:04 +0000 (02:26 +0200)] 
Streamline fixed size dumpers by dumping directly in the output buffer

4 years agoDrop unused import
Daniele Varrazzo [Sun, 16 May 2021 00:25:40 +0000 (02:25 +0200)] 
Drop unused import

4 years agoDon't chain exceptions raising in decimal binary loading
Daniele Varrazzo [Sun, 16 May 2021 00:24:50 +0000 (02:24 +0200)] 
Don't chain exceptions raising in decimal binary loading

4 years agoDon't chain exceptions throwing DataError in dates
Daniele Varrazzo [Sat, 15 May 2021 23:05:04 +0000 (01:05 +0200)] 
Don't chain exceptions throwing DataError in dates

4 years agoLoad dates using slices instead of regexps
Daniele Varrazzo [Sat, 15 May 2021 16:23:46 +0000 (18:23 +0200)] 
Load dates using slices instead of regexps

Some 40% faster. Thanks to @hakib for the tip :)

4 years agoFaster date/timestamp parsing
Daniele Varrazzo [Sat, 15 May 2021 15:38:45 +0000 (17:38 +0200)] 
Faster date/timestamp parsing

4 years agoUniform interval parsing to the other data types
Daniele Varrazzo [Sat, 15 May 2021 14:17:23 +0000 (16:17 +0200)] 
Uniform interval parsing to the other data types

4 years agoBase timestamptz loader on regexp
Daniele Varrazzo [Sat, 15 May 2021 13:41:26 +0000 (15:41 +0200)] 
Base timestamptz loader on regexp

About 4.5x faster than strptime.