summaryrefslogtreecommitdiff
path: root/psycopg
Commit message (Collapse)AuthorAgeFilesLines
* Fixed adaptation of arrays of arrays of nullsDaniele Varrazzo2018-05-181-32/+81
| | | | Close #325, close #706.
* Allow strings subclasses in ensure_bytesfix-679Daniele Varrazzo2018-02-211-2/+2
| | | | Fix #679
* Avoid quoting the string in the psycopg version macroDaniele Varrazzo2018-02-191-2/+6
| | | | | | | Use a macro trick to add the quotes. This seems more portable than passing the quotes to the command line (see #658). https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html
* Fixed building on SmartOSMike Gerdts2018-02-192-1/+7
| | | | | timeradd is missing on Solaris 10, but is present as a macro in <sys/time.h> on SmartOS, illumos, and likely Solaris 11.
* Autocommit shouldn't change deferrable on servers not supporting itDaniele Varrazzo2018-02-081-2/+2
| | | | Regression on unsupported Postgres versions after fixing bug #580
* Fixed idempotence check changing connection characteristicsDaniele Varrazzo2018-01-112-22/+36
|
* 'cursor.mogrify()' can be called on closed cursorsmogrify-on-closed-cursorDaniele Varrazzo2018-01-111-2/+0
| | | | Fix #579.
* Merge branch 'macro-accessors'Daniele Varrazzo2018-01-102-2/+9
|\
| * Moved datatime compatibility macros with othersDaniele Varrazzo2018-01-102-6/+5
| |
| * define a "polyfill" inline for python 2 compatibilityGlyph2017-12-121-0/+6
| |
| * use accessor macros for pypy3 compatibilityGlyph2017-12-121-2/+4
| |
* | Fix typo in comment in utils.cRonan Amicel2017-12-141-1/+1
|/
* Trim trailing whitespace from all files throughout projectJon Dufresne2017-12-015-6/+0
| | | | | | Many editors automatically trim whitespace on save. By trimming all files in one go, makes future diffs cleaner without extraneous whitespace changes.
* Collect rowcount in executemany even when discarding resultsDaniele Varrazzo2017-11-291-1/+2
| | | | Closes #633.
* Add news and update version checkHugo2017-11-281-2/+4
|
* Drop support for EOL Python 2.6Hugo2017-11-281-10/+2
|
* Merge branch 'solaris-support'Daniele Varrazzo2017-11-283-0/+95
|\
| * Emulate timeradd and timersub on SolarisMy Karlsson2017-10-263-0/+95
| | | | | | | | | | Solaris does not have timeradd and timersub. Add solaris_support.c which provides emulated versions of them on Solaris.
* | Don't cast point arrays to float arrays (fixes: #613)Federico Di Gregorio2017-11-161-1/+1
|/
* Added back timestamptz[] default castfix-578Daniele Varrazzo2017-07-242-0/+2
| | | | | | | | | | It was registered as side effect of an excessive definition that got cleaned up in 338dbe70a6c78c7edddea985e2386ebd864378c6. Looking at other removed redundant type oids, this was the only one missing from the `string_types` map. Close #578.
* Accept Composable in start_replication_expert()Daniele Varrazzo2017-06-174-86/+97
| | | | Close #554
* Fixed parsing interval from micros on 32 bitDaniele Varrazzo2017-06-171-2/+1
| | | | Using integers the wrong size. Faithfully segfaulting since 1970.
* Parse a number as microseconds when casting intervalbug-558Daniele Varrazzo2017-06-161-0/+53
| | | | | | Should close #558, but I'm curious to know if a number is returned for interval < 1 day too (which wouldn't trigger the overflow, but will finish parsing with part=0).
* Dropped wrong associations of PG types to datetime objectDaniele Varrazzo2017-06-151-2/+2
| | | | | | The wrong associations are overwritten in the typecaster map by the right ones, so they have been harmless to date, but only because of the order of creation of the adapters.
* Check return code from decoding the connection statusDaniele Varrazzo2017-06-151-2/+6
| | | | | | | | | It fails on Py3 after receiving a SIGABRT. Because we don't handle it here it will resurface later with nonsense such as: SystemError: <some function> returned a result with an error set Close #551
* Merge branch 'fix-547'Daniele Varrazzo2017-04-191-1/+1
|\
| * Fixed args parsing in ReplicationCursor.consume_stream()Daniele Varrazzo2017-04-191-1/+1
| | | | | | | | Close #547.
* | Merge remote-tracking branch 'fix_lobject_factory'Daniele Varrazzo2017-04-191-1/+1
|\ \
| * | Fix name of lobject keyword argumentFrazer McLean2017-04-161-1/+1
| |/
* | Handle lobject mode=None correctlyFrazer McLean2017-04-161-1/+4
|/
* Don't clobber a Python exception with an unknown errorDaniele Varrazzo2017-04-051-0/+4
| | | | Close #410
* Return objects with timezone parsing infinity timestamptzDaniele Varrazzo2017-03-224-67/+139
| | | | Close #536.
* replication connection init refactored to use psyco_make_dsnDaniele Varrazzo2017-03-161-34/+22
| | | | | | Some extra bonus refactoring to improve the function readability (don't reuse names for variables with different refcount rules, don't pass separate obj/self, async pass-through...)
* Obscure the password on url dsn tooDaniele Varrazzo2017-03-163-8/+72
| | | | | | Note that we don't leak anymore the password length. Fix #528
* Password scrubbing refactored in a separate functionfix-528Daniele Varrazzo2017-03-151-7/+18
|
* Always raise OperationalError when connection was closed externally.Greg Ward2017-03-141-4/+6
| | | | | | | | | | | | | | | From the DB-API (https://www.python.org/dev/peps/pep-0249/): OperationalError Exception raised for errors that are related to the database's operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, [...] Additionally, psycopg2 was inconsistent, at least in the async case: depending on how the "connection closed" error was reported from the kernel to libpq, it would sometimes raise OperationalError and sometimes DatabaseError. Now it always raises OperationalError.
* Always detect when a connection is closed behind psycopg2's back.Greg Ward2017-03-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a race condition that only seems to happen over Unix-domain sockets. Sometimes, the closed socket is reported by the kernel to libpq like this (captured with strace): sendto(3, "Q\0\0\0\34select pg_backend_pid()\0", 29, MSG_NOSIGNAL, NULL, 0) = 29 recvfrom(3, "E\0\0\0mSFATAL\0C57P01\0Mterminating "..., 16384, 0, NULL, NULL) = 110 recvfrom(3, 0x12d0330, 16384, 0, 0, 0) = -1 ECONNRESET (Connection reset by peer) That is, psycopg2/libpq sees no error when sending the first query after the connection is closed, but gets an error reading the result. In that case, everything worked fine. But sometimes, the error manifests like this: sendto(3, "Q\0\0\0\34select pg_backend_pid()\0", 29, MSG_NOSIGNAL, NULL, 0) = -1 EPIPE (Broken pipe) recvfrom(3, "E\0\0\0mSFATAL\0C57P01\0Mterminating "..., 16384, 0, NULL, NULL) = 110 recvfrom(3, "", 16274, 0, NULL, NULL) = 0 recvfrom(3, "", 16274, 0, NULL, NULL) = 0 i.e. libpq received an error when sending the query. This manifests as a slightly different exception from a slightly different place. More importantly, in this case connection.closed is left at 0 rather than being set to 2, and that is the bug I'm fixing here. Note that we see almost identical behaviour for sync and async connections, and the fixes are the same. So I added extremely similar test cases. Finally, there is still a bug here: for async connections, we sometimes raise DatabaseError (incorrect) and sometimes raise OperationalError (correct). Will fix that next.
* Don't use PG_INT64_TYPEDaniele Varrazzo2017-03-021-1/+1
| | | | | | | Only defined in Postgres 9.3 Should close #520, but let's wait for the CI response (build on Windows etc.)
* Dropped compiler warning on WindowsDaniele Varrazzo2017-02-241-1/+1
|
* Handle overflow in interval parsingDaniele Varrazzo2017-02-241-2/+14
|
* Make sure to use 64 bits in interval parsing accumulatorsDaniele Varrazzo2017-02-241-12/+10
|
* Parse interval only using integersDaniele Varrazzo2017-02-241-31/+36
| | | | | | | | | (almost... except for micros rounding) While this is probably an improvement on the previous implementation, I am largely waving a dead chicken at windows, which keeps failing to pass the seconds overflow test. If it doesn't pass now either I'll start blaming Python's timedelta.
* Try to fix the same problem in windowsDaniele Varrazzo2017-02-241-4/+4
| | | | | Previous commit doesn't pass on Windows: it looks like window's floor() has an integer overflow.
* Fixed integer overflow in interval typecasterDaniele Varrazzo2017-02-241-4/+4
| | | | Close #512.
* Revert default_transaction_* to default only if setsession-attributesDaniele Varrazzo2017-02-161-9/+13
| | | | | | When moving from autocommit True -> False reset only the server parameters that were actually specified by psycopg to honour the serssion characteristics.
* Check for deferrable unsupported applied to attribute tooDaniele Varrazzo2017-02-162-7/+8
|
* Added readonly and deferrable attributesDaniele Varrazzo2017-02-163-29/+115
|
* Revert pre-2.7b1 behaviour of silent rollback on conn.set_isolation_level()Daniele Varrazzo2017-02-161-1/+7
| | | | Legacy method is legacy.
* connection.isolation_level is now writableDaniele Varrazzo2017-02-161-13/+53
|
* Allowed inittype.h's defs all versions of MSVCJason Erickson2017-02-101-2/+0
| | | | | Apparently only MSVC 2015 x64 had defined these types. Changed check to work for all versions of MSVC. Does not affect 2015x64.