Commit Graph

457 Commits

Author SHA1 Message Date
Daniele Varrazzo
5283a835dc chore: add TransactionTimeout error, added in PostgreSQL 17
Url to fetch source changed from the official Postgres one to the Github
mirror because the former throttled us.
2024-10-11 02:41:31 +02:00
Daniele Varrazzo
29a65f756c chore: upgrade error codes to PostgreSQL 15 2022-10-06 02:26:09 +01:00
Daniele Varrazzo
ac25d3bdc0 fix: look up for range types defined in schemas in the search path 2022-10-06 02:05:39 +01:00
Daniele Varrazzo
9535462ce9 fix: correctly handle composites with names or schema requiring escape 2022-10-06 01:56:28 +01:00
Daniele Varrazzo
d88e4c2a3c fix: handle types in the search path in register_composite()
Fix #1487.
2022-10-06 01:10:07 +01:00
Nikita Sobolev
3e7bb8d1aa Remove __nonzero__ method 2022-07-30 14:03:10 +02:00
Daniele Varrazzo
7dd193a7f7 errorcodes map and errors classes updated to PostgreSQL 14. 2021-11-11 20:08:39 +01:00
Daniele Varrazzo
b241def64b Fix representation of sql.Placeholder
Fix also Placeholder tests, including an error which made an assert
always true, which made us miss the regression in #1291.
2021-06-17 00:28:14 +01:00
Daniele Varrazzo
dd2ff2af56 Fix regression with named sql.Placeholder
Close #1291.
2021-06-16 23:56:05 +01:00
Daniele Varrazzo
1d3a89a0bb Copyright year updated to 2021
ag -l Copyright | xargs sed -i \
    "s/\(.*copyright (C) [0-9]\+\)\(-[0-9]\+\)\?\(.*Psycopg Team.*\)/\1-$(date +%Y)\3/I"
2021-06-15 00:37:22 +01:00
Daniele Varrazzo
1d3d5e905f Deprecate the psycopg2.tz module
Don't use its objects anymore in the tests (except for the tests for the
objects themselves).
2021-06-15 00:22:54 +01:00
Daniele Varrazzo
2eac70786e Drop support for mx.DateTime objects
They are Python 2 only.
2021-06-14 23:05:48 +01:00
Daniele Varrazzo
476a969bd8 Handle correctly timestamps with fractions of minute in the timezone offset
Close #1272.
2021-06-14 22:25:02 +01:00
Yusuke Hayashi
fed22d39e9 Fix typo 2021-05-22 14:30:11 +02:00
Daniele Varrazzo
3db4abcfa4 Unbreak f-string wrong replacements 2021-05-20 16:49:05 +02:00
Daniele Varrazzo
8f40c648af Merge branch 'master' into rm-2.7 2021-05-20 16:36:55 +02:00
Daniele Varrazzo
391386cfb9 Accept no param in connect()
More friendly towards ``connect(**parse_dsn())``, and what psycopg3 does.

Close #1250
2021-05-20 13:10:53 +02:00
Hugo van Kemenade
c3b65d63b6 Upgrade f-strings with flynt -a and remove int() 2020-11-18 18:09:08 +02:00
Hugo van Kemenade
8d7f660309 Upgrade f-strings with flynt 2020-11-17 23:52:11 +02:00
Hugo van Kemenade
d956eaa3b1 Drop support for EOL Python 2.7 2020-11-17 22:53:44 +02:00
Hugo van Kemenade
7babeccbec Upgrade Python syntax with pyupgrade --py36-plus 2020-11-17 22:22:11 +02:00
Hugo van Kemenade
6c48b63ae4 Drop support for EOL Python 2.7 2020-11-17 22:22:11 +02:00
Daniele Varrazzo
dd1724c447 Errors mapping updated to PostgreSQL 13 2020-09-05 20:26:19 +01:00
Daniele Varrazzo
c203d681c4 Added duplicate values to errcodes module
Close #1133
2020-09-05 20:26:19 +01:00
Alexey Bashtanov
96f0f63de2 dictcursor-docs-improvement 2020-06-18 15:40:45 +01:00
Daniele Varrazzo
62743c3be1 Fixed copy() on DictRow
Close #1073.
2020-04-06 14:10:02 +12:00
Daniele Varrazzo
34c54f3fc3 Merge branch 'logging-adapter' 2020-03-08 11:23:32 +00:00
Daniele Varrazzo
5e0b02afb2 Copyright bumped to 2020 2020-01-17 21:21:11 +00:00
Bjoern Boschman
93aa469f16 #1026 added support for logging.LoggerAdapter 2020-01-07 13:46:21 +00:00
Daniele Varrazzo
c3c24cd67b Website on https 2019-12-31 13:09:13 +01:00
Daniele Varrazzo
9154d0920c Changed docs to point to psycopg.org 2019-12-30 18:12:46 +01:00
Daniele Varrazzo
c20c13c493 Fixed use of cursor_factory attribute in connecion subclasses
Close #1019
2019-12-09 11:11:39 +00:00
Daniele Varrazzo
d5c7ec7ae8 Added Postgres 12 errors 2019-10-19 15:22:48 +02:00
Daniele Varrazzo
be8e1a2632 Making my linter happy 2019-06-07 18:20:36 +01:00
Changaco
842e383c0c fix NamedTupleCursor._cached_make_nt 2019-06-04 14:30:30 +02:00
Alexander Kukushkin
6cff5a3e08 Smart replication feedback
This commit makes psycopg2 responsible for sending the status update
(feedback) messages to the server regardless of whether a synchronous or
asynchronous connection is used.

Feedback is sent every *status_update* (default value is 10) seconds,
which could be configured by passing a corresponding parameter to the
`start_replication()` or `start_replication_expert()` methods.
The actual feedback message is sent by the
`pq_read_replication_message()` when the *status_update* timeout is
reached.

The default behavior of the `send_feedback()` method is changed.
It doesn't send a feedback message on every call anymore but just
updates internal structures. There is still a way to *force* sending
a message if *force* or *reply* parameters are set.

The new approach has certain advantages:
1. The client can simply call the `send_feedback()` for every
   processed message and the library will take care of not overwhelming
   the server. Actually, in the synchronous mode it is even mandatory
   to confirm every processed message.
2. The library tracks internally the pointer of the last received
   message which is not keepalive. If the client confirmed the last
   message and after that server sends only keepalives with increasing
   *wal_end*, the library can safely move forward *flush* position to
   the *wal_end* and later automatically report it to the server.

Reporting of the *wal_end* received from keepalive messages is very
important. Not doing so casing:
1. Excessive disk usage, because the replication slot prevents from
   WAL being cleaned up.
2. The smart and fast shutdown of the server could last indefinitely
   because walsender waits until the client report *flush* position
   equal to the *wal_end*.

This implementation is only extending the existing API and therefore
should not break any of the existing code.
2019-05-06 10:27:44 +02:00
Daniele Varrazzo
4058f363d6 More robust RealDictRow population
In the presence of repeated columns the mapping would have remained into
into the dictionary. Now it is removed.

Fix #884
2019-04-06 21:17:28 +01:00
Daniele Varrazzo
cc815e8e8d RealDictRow inherits from OrderedDict
Now its state is unmodified, so apart from special-casing creation
and initial population can work unmodified, and all the desired
properties just work (modifiability, picklability...)

Close #886.
2019-04-06 19:43:31 +01:00
Daniele Varrazzo
21d16b6f67 Fixed RealDictCursor.pop()
Addresses #886, but there might be something else broken there.
2019-04-06 19:43:09 +01:00
Daniele Varrazzo
b4b470c29a Allow 0 as key in the pool
Close #848
2019-03-17 18:24:50 +00:00
Daniele Varrazzo
dfb301b42b Use PY2, PY3 for conditional code instead of sys.version_info 2019-03-16 19:54:40 +00:00
Daniele Varrazzo
f4a2630f1a Added PY2, PY3 to compat module 2019-03-16 19:54:40 +00:00
Jon Dufresne
8685120485 Remove unnecessary except ImportError for Python datetime types
The Python datetime module is available on all supported platforms. The
types are always available and never raise an ImportError.
2019-03-16 16:35:51 +00:00
Jon Dufresne
3f890f8bbe Use True/False instead of 1/0 to represent bool values
Slightly more modern, readable, and Pythonic.
2019-03-13 11:13:36 +00:00
Jon Dufresne
03bb44dd2c Convert while 1: statements to while True:
A slightly more readable and modern syntax.
2019-03-13 11:13:05 +00:00
David Fischer
147ff65e4a Fix typo 2019-02-26 11:33:48 +01:00
Daniele Varrazzo
599432552a Copyright year updated
ag -l Copyright | xargs sed -i \
        "s/\(.*copyright (C) [0-9]\+\)\(-[0-9]\+\)\?\(.*\)/\1-$(date +%Y)\3/I"
2019-02-17 01:36:36 +00:00
Daniele Varrazzo
30c1befa64 SQLSTATE error classes implemented in C
The module is only used to export them to Python.
2019-02-10 03:45:14 +00:00
Daniele Varrazzo
35ec7ad9c1 Use a proper LRU cache for namedtuples
Previous one didn't refresh by last use. Use the stdlib version for py3
and one of our own for py2.

Max size set to 512, which should be fine for everyone (tweaking is
still possible by monkeypatching, as the tests do, but I don't want to
make an interface of it).
2019-02-02 19:29:20 +00:00
Daniele Varrazzo
805527fcd6 Added caching of types generated by NamedTupleCursor
see #838
2019-02-02 14:22:25 +00:00