]>
git.ipfire.org Git - thirdparty/psycopg.git/log
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
Daniele Varrazzo [Fri, 25 Jun 2021 16:54:19 +0000 (17:54 +0100)]
Merge branch 'binary-range'
Daniele Varrazzo [Tue, 8 Jun 2021 18:24:39 +0000 (19:24 +0100)]
Move basic struct-related functions to a common module
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.
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().
Daniele Varrazzo [Wed, 23 Jun 2021 12:10:57 +0000 (13:10 +0100)]
Fix rounding error in float comparison tests with postgres < 12
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.
Daniele Varrazzo [Wed, 9 Jun 2021 15:44:34 +0000 (16:44 +0100)]
Test random range objects
Daniele Varrazzo [Wed, 9 Jun 2021 00:31:48 +0000 (01:31 +0100)]
Add range binary dumpers
Daniele Varrazzo [Wed, 9 Jun 2021 15:43:05 +0000 (16:43 +0100)]
Add Range.bounds attribute
Daniele Varrazzo [Tue, 8 Jun 2021 20:27:40 +0000 (21:27 +0100)]
Add RecursiveDumper, RecursiveLoader
Daniele Varrazzo [Tue, 8 Jun 2021 19:08:29 +0000 (20:08 +0100)]
Add range binary loaders
Daniele Varrazzo [Wed, 23 Jun 2021 11:45:03 +0000 (12:45 +0100)]
Fix interval and timezone parsing in copy buffers
Daniele Varrazzo [Tue, 22 Jun 2021 10:57:01 +0000 (11:57 +0100)]
Make tests.pq a module to allow relative import
Daniele Varrazzo [Tue, 22 Jun 2021 10:54:02 +0000 (11:54 +0100)]
Mark timing based test flaky
Daniele Varrazzo [Tue, 22 Jun 2021 10:38:18 +0000 (11:38 +0100)]
Insist more on the GC tests
Daniele Varrazzo [Tue, 22 Jun 2021 09:48:29 +0000 (10:48 +0100)]
Merge branch 'sql-as-bytes'
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.
Denis Laxalde [Thu, 10 Jun 2021 11:52:28 +0000 (13:52 +0200)]
Auto-document Composable.as_bytes()
Denis Laxalde [Thu, 10 Jun 2021 11:27:05 +0000 (13:27 +0200)]
Make Composable an abstract base class
Denis Laxalde [Thu, 10 Jun 2021 11:24:10 +0000 (13:24 +0200)]
Drop inheritance from 'object' in sql module and tests
Daniele Varrazzo [Thu, 17 Jun 2021 12:31:32 +0000 (13:31 +0100)]
Trigger docs update to the website build workflow on GitHub Action
Daniele Varrazzo [Thu, 17 Jun 2021 00:44:53 +0000 (01:44 +0100)]
Don't require the virtualenv binary to build the docs
Daniele Varrazzo [Mon, 14 Jun 2021 09:46:19 +0000 (10:46 +0100)]
Add missing return type annotation
Daniele Varrazzo [Mon, 14 Jun 2021 09:42:49 +0000 (10:42 +0100)]
Find the failing value when a random insert fails
Daniele Varrazzo [Thu, 10 Jun 2021 16:08:12 +0000 (17:08 +0100)]
Fix float parsing when the data buffer is not terminated
Daniele Varrazzo [Thu, 10 Jun 2021 10:25:47 +0000 (11:25 +0100)]
Fix DB API Binary wrapper
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
Daniele Varrazzo [Thu, 10 Jun 2021 11:05:11 +0000 (12:05 +0100)]
Drop timeout on workflow test step
Daniele Varrazzo [Wed, 9 Jun 2021 23:06:45 +0000 (00:06 +0100)]
Longer test run timeout
Daniele Varrazzo [Wed, 9 Jun 2021 16:28:32 +0000 (17:28 +0100)]
Fix reveal_type tests to mypy 0.901 output format
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.
Daniele Varrazzo [Tue, 8 Jun 2021 16:09:40 +0000 (17:09 +0100)]
Merge branch 'connect-timeout'
Denis Laxalde [Thu, 6 May 2021 06:42:08 +0000 (08:42 +0200)]
Raise OperationalError 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.
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.
Daniele Varrazzo [Tue, 8 Jun 2021 10:41:17 +0000 (11:41 +0100)]
Merge branch 'network-binary'
Daniele Varrazzo [Tue, 8 Jun 2021 04:07:04 +0000 (05:07 +0100)]
Generate random ipaddress objects for testing
Daniele Varrazzo [Tue, 8 Jun 2021 03:48:12 +0000 (04:48 +0100)]
Add network types binary loaders
Daniele Varrazzo [Tue, 8 Jun 2021 03:15:34 +0000 (04:15 +0100)]
Add ipaddress binary dumpers
Daniele Varrazzo [Tue, 8 Jun 2021 01:42:43 +0000 (02:42 +0100)]
Drop utils sub-package
Daniele Varrazzo [Tue, 8 Jun 2021 01:32:26 +0000 (02:32 +0100)]
Merge branch 'c-datetime-adapters'
Daniele Varrazzo [Tue, 8 Jun 2021 01:00:43 +0000 (02:00 +0100)]
Add C interval text loader
Daniele Varrazzo [Mon, 7 Jun 2021 22:37:11 +0000 (23:37 +0100)]
Add C interval binary loader
Daniele Varrazzo [Mon, 7 Jun 2021 21:42:22 +0000 (22:42 +0100)]
Use consistently 'us' instead of 'ms' for microseconds
Daniele Varrazzo [Mon, 7 Jun 2021 20:44:00 +0000 (21:44 +0100)]
Pad second fractions to micros using a lookup table
Daniele Varrazzo [Mon, 7 Jun 2021 20:29:42 +0000 (21:29 +0100)]
Add timestamptz c binary loader
Daniele Varrazzo [Sun, 6 Jun 2021 23:38:56 +0000 (00:38 +0100)]
Add timestamptz c text loader
Daniele Varrazzo [Sun, 6 Jun 2021 23:25:20 +0000 (00:25 +0100)]
Drop code duplication in date/time parsing
Daniele Varrazzo [Sun, 6 Jun 2021 21:31:33 +0000 (22:31 +0100)]
Add c timestamp binary loader
Daniele Varrazzo [Sun, 6 Jun 2021 21:30:51 +0000 (22:30 +0100)]
Parse datetype without using endswith in c
Daniele Varrazzo [Wed, 2 Jun 2021 13:13:40 +0000 (14:13 +0100)]
Add c text timestamp loader
Daniele Varrazzo [Wed, 2 Jun 2021 10:42:12 +0000 (11:42 +0100)]
Add c timetz binary loader
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.
Daniele Varrazzo [Wed, 2 Jun 2021 03:28:07 +0000 (04:28 +0100)]
Add c text timetz loader
Daniele Varrazzo [Wed, 2 Jun 2021 02:44:48 +0000 (03:44 +0100)]
Add c binary time loader
Daniele Varrazzo [Wed, 2 Jun 2021 02:27:44 +0000 (03:27 +0100)]
Add c text time loader
Daniele Varrazzo [Wed, 2 Jun 2021 01:55:59 +0000 (02:55 +0100)]
Add c timedelta dumpers
Daniele Varrazzo [Wed, 2 Jun 2021 01:29:33 +0000 (02:29 +0100)]
Add c datetime binary dumpers
Daniele Varrazzo [Wed, 2 Jun 2021 00:49:23 +0000 (01:49 +0100)]
Add c datetime text dumpers
Daniele Varrazzo [Wed, 2 Jun 2021 00:43:22 +0000 (01:43 +0100)]
Rationalise date dumpers inheritance tree
Daniele Varrazzo [Sun, 16 May 2021 22:46:50 +0000 (00:46 +0200)]
Add C time dumpers
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
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.
Daniele Varrazzo [Sun, 16 May 2021 00:24:08 +0000 (02:24 +0200)]
Complete C date adapters, text and binary
Daniele Varrazzo [Sat, 15 May 2021 23:27:21 +0000 (01:27 +0200)]
Add C date loader
8x faster than the Python loader
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.
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.
Daniele Varrazzo [Sun, 16 May 2021 00:52:50 +0000 (02:52 +0200)]
Merge branch 'tzinfo'
Daniele Varrazzo [Sun, 16 May 2021 00:26:04 +0000 (02:26 +0200)]
Streamline fixed size dumpers by dumping directly in the output buffer
Daniele Varrazzo [Sun, 16 May 2021 00:25:40 +0000 (02:25 +0200)]
Drop unused import
Daniele Varrazzo [Sun, 16 May 2021 00:24:50 +0000 (02:24 +0200)]
Don't chain exceptions raising in decimal binary loading
Daniele Varrazzo [Sat, 15 May 2021 23:05:04 +0000 (01:05 +0200)]
Don't chain exceptions throwing DataError in dates
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 :)
Daniele Varrazzo [Sat, 15 May 2021 15:38:45 +0000 (17:38 +0200)]
Faster date/timestamp parsing
Daniele Varrazzo [Sat, 15 May 2021 14:17:23 +0000 (16:17 +0200)]
Uniform interval parsing to the other data types
Daniele Varrazzo [Sat, 15 May 2021 13:41:26 +0000 (15:41 +0200)]
Base timestamptz loader on regexp
About 4.5x faster than strptime.
Daniele Varrazzo [Sat, 15 May 2021 12:56:15 +0000 (14:56 +0200)]
Base TimeTz loader on regexp
Daniele Varrazzo [Sat, 15 May 2021 12:55:56 +0000 (14:55 +0200)]
Further tweaks to date/time loaders
Daniele Varrazzo [Sat, 15 May 2021 11:23:26 +0000 (13:23 +0200)]
Base time loader on regexp
Some 5x faster
Daniele Varrazzo [Sat, 15 May 2021 10:47:58 +0000 (12:47 +0200)]
Base date and timestamp loaders on regexp instead of strptime
Not only is 4x faster, but it's more straightforward to port to C
and keep similar algorithms (even if we decide to drop regexp in C)
Daniele Varrazzo [Sat, 15 May 2021 10:45:48 +0000 (12:45 +0200)]
Separate date/time tests in classes
Daniele Varrazzo [Fri, 14 May 2021 18:04:23 +0000 (20:04 +0200)]
Fix datetime timezone adjustment on Python 3.6
Daniele Varrazzo [Fri, 14 May 2021 17:42:29 +0000 (19:42 +0200)]
Add test for timestamptz timezone load behaviour
Daniele Varrazzo [Fri, 14 May 2021 17:26:37 +0000 (19:26 +0200)]
Add docs and tests for ConnectionInfo.timezone
Daniele Varrazzo [Fri, 14 May 2021 16:37:24 +0000 (18:37 +0200)]
Move timezone attribute to the Connection.info interface
Type changed to the abstract `datetime.tzinfo` so that we have the
option to return something else such as a `datetime.timezone` with fixed
offset.
Added function to retrieve the object internally from the PGconn.
Daniele Varrazzo [Fri, 14 May 2021 16:19:32 +0000 (18:19 +0200)]
Warn only once about unknown zoneinfo
Daniele Varrazzo [Fri, 14 May 2021 15:50:06 +0000 (17:50 +0200)]
Return timestamptz in the connection timezone
First cut, more tests to add. All current tests pass, except the
explicit checks for UTC tzinfo returned.
See https://github.com/psycopg/psycopg3/discussions/56
Daniele Varrazzo [Fri, 14 May 2021 15:07:03 +0000 (17:07 +0200)]
Merge branch 'master' into binary-datetime
Daniele Varrazzo [Fri, 14 May 2021 14:51:17 +0000 (16:51 +0200)]
Make the dependency on typing_extension optional
Daniele Varrazzo [Thu, 13 May 2021 21:04:19 +0000 (23:04 +0200)]
Return timestamptz as utc datetime loading in text format
This makes text and binary loaders return the same value. It also fixes
the problem of the missing seconds in the timezone offset on Python 3.6.
The opposite choice, returning datetime in the connection timezone on
binary loading, doesn't seem really feasible: pytz cannot parse all the
Postgres timezone values (for instance, "+02:00" can't be parsed): take
a look at
https://www.postgresql.org/docs/13/datetime-posix-timezone-specs.html to
understand how much of a bad idea it would be.
Daniele Varrazzo [Thu, 13 May 2021 16:41:04 +0000 (18:41 +0200)]
Fix timestamptz binary tests with seconds in the timezone on Python 3.6
Daniele Varrazzo [Thu, 13 May 2021 09:49:33 +0000 (11:49 +0200)]
Consider loss of precision in negative binary timestamps too
Daniele Varrazzo [Thu, 13 May 2021 02:10:31 +0000 (04:10 +0200)]
Add timedelta/interval binary adapter
Daniele Varrazzo [Thu, 13 May 2021 01:19:11 +0000 (03:19 +0200)]
Add timestamptz adapter
Daniele Varrazzo [Wed, 12 May 2021 23:17:50 +0000 (01:17 +0200)]
Force text query in tests playing with datestyle
Just in case in the future we switch to binary return values and we stop
testing anything.
Daniele Varrazzo [Wed, 12 May 2021 23:13:20 +0000 (01:13 +0200)]
Add datetime binary adapter
Only for naive datetimes, timezone not handled yet.
Daniele Varrazzo [Wed, 12 May 2021 20:44:26 +0000 (22:44 +0200)]
Add timetz binary adapters
Daniele Varrazzo [Wed, 12 May 2021 19:38:58 +0000 (21:38 +0200)]
Add time binary adapters
No timezone yet, some tests fail.
Daniele Varrazzo [Wed, 12 May 2021 18:55:40 +0000 (20:55 +0200)]
Add date binary adapters