Commit Graph

2267 Commits

Author SHA1 Message Date
Daniele Varrazzo
4b4d2796b7 Merge branch 'fix-410' 2017-04-05 15:16:01 +01:00
Daniele Varrazzo
cd095ef0ee Added test to verify callback errors in named cursors
They work fine.
2017-04-05 14:54:07 +01:00
Daniele Varrazzo
a66c34a6d0 Don't clobber a Python exception with an unknown error
Close #410
2017-04-05 14:54:07 +01:00
Daniele Varrazzo
47f5e97759 Added test to verify #410
The 'unknown error' happens on query.
2017-04-05 14:54:07 +01:00
Daniele Varrazzo
3b48918bef Note that the fast executemany functions don't respect rowcount
See issue #540
2017-03-28 10:37:04 +01:00
Daniele Varrazzo
adf55babe8 Merge remote-tracking branch 'origin/fix-536' 2017-03-22 12:19:31 +00:00
Daniele Varrazzo
b94548f5a3 Fix curl not found on AppVeyor
http://help.appveyor.com/discussions/problems/6312-curl-command-not-found
2017-03-22 03:54:23 +00:00
Daniele Varrazzo
ee9948fa86 Expose *DATETIMETZ* objects in the extensions module 2017-03-22 03:42:12 +00:00
Daniele Varrazzo
57b1093b31 Find again mxDateTime includes in default locations 2017-03-22 03:36:08 +00:00
Daniele Varrazzo
7214c6652e Return objects with timezone parsing infinity timestamptz
Close #536.
2017-03-22 03:03:02 +00:00
Daniele Varrazzo
31f91e033f Dropped info that the features requires libpq >= 9.0
We are currently requiring libpq 9.1 at least, and the feature was
released in 2.7, which could have never been compiled with previos
libpq versions.
2017-03-20 19:08:18 +00:00
Daniele Varrazzo
1e0aef032f Dropped repeated doc links in the same paragraph
And some more sql docs cleanup.
2017-03-16 04:40:22 +00:00
Daniele Varrazzo
f9b36433fb Merge branch 'fix-528' 2017-03-16 04:24:17 +00:00
Daniele Varrazzo
ba0329fb40 replication connection init refactored to use psyco_make_dsn
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...)
2017-03-16 03:55:22 +00:00
Daniele Varrazzo
9f160fd820 Obscure the password on url dsn too
Note that we don't leak anymore the password length.

Fix #528
2017-03-16 03:53:40 +00:00
Daniele Varrazzo
c7f5690426 Added docs about the usability of sql objects with copy_expert()
See issue #529.
2017-03-16 00:55:20 +00:00
Daniele Varrazzo
3bfbd3a0a5 Added test to verify sql objects work with copy_expert()
I'll be honest: I lucked out, I didn't think about this combination. But
maybe sheer luck, maybe using common code paths, it just works. Let's
make it stays so.
2017-03-16 00:55:20 +00:00
Daniele Varrazzo
103655d670 Password scrubbing refactored in a separate function 2017-03-15 16:04:45 +00:00
Daniele Varrazzo
cc047a445a Added tests to verify the password is obscured
The url test fails: see issue #528
2017-03-15 16:00:40 +00:00
Daniele Varrazzo
7187d6408a Merge branch 'fix-443' 2017-03-14 14:41:48 +00:00
Daniele Varrazzo
3626e961f8 Reported bug #443 fixed *again*
Also see ticket #527.
2017-03-14 14:16:02 +00:00
Daniele Varrazzo
8e28444897 Bunch of test tweaks to make the test grid green 2017-03-14 14:15:52 +00:00
Daniele Varrazzo
7c2333dd81 Connection state fixed noted in the news 2017-03-14 14:15:52 +00:00
Greg Ward
12317557da Always raise OperationalError when connection was closed externally.
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.
2017-03-14 12:14:00 +00:00
Greg Ward
b203a7c775 Always detect when a connection is closed behind psycopg2's back.
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.
2017-03-14 12:08:03 +00:00
Daniele Varrazzo
3c124a0b87 Flake8 complaints 2017-03-14 12:06:46 +00:00
Daniele Varrazzo
ef9f9f5fff Improved notes to release psycopg packages 2017-03-13 16:50:57 +00:00
Daniele Varrazzo
5730aa9a40 Less stuff in the readme, more in the docs 2017-03-13 12:13:47 +00:00
Daniele Varrazzo
8ed0196d02 Bump to next dev release 2017-03-13 11:50:34 +00:00
Daniele Varrazzo
09c48c76c3 Bump to version 2.7.1 2017-03-11 17:03:22 +00:00
Daniele Varrazzo
b075c7169c Report ticket 518 fixed
The fix is actually implemented in the openssl1 branch of
https://github.com/psycopg/psycopg2-wheels
2017-03-11 17:00:58 +00:00
Jon Nelson
c661695b28 correct minor grammatical issue with deprecation warning 2017-03-03 13:54:22 +00:00
Daniele Varrazzo
06fbd0ee02 Dropped "what's new in 2.7.1" from docs index 2017-03-03 13:50:57 +00:00
Daniele Varrazzo
e3f56718d2 Added install section to specify how to skip wheels 2017-03-03 13:49:19 +00:00
Daniele Varrazzo
d007dc3249 Merge branch 'fix-520' 2017-03-02 19:36:45 +00:00
Daniele Varrazzo
a5382d7b72 Skip the tests according to the earliest of libpq built/linked. 2017-03-02 19:32:44 +00:00
Daniele Varrazzo
26bd5df048 Don't use PG_INT64_TYPE
Only defined in Postgres 9.3

Should close #520, but let's wait for the CI response (build on
Windows etc.)
2017-03-02 19:32:39 +00:00
Daniele Varrazzo
3a441467c0 Merge branch 'no-unittest2'
Close #516
2017-03-02 12:41:33 +00:00
Daniele Varrazzo
6be94f1927 Merge branch 'fix-517' 2017-03-02 12:22:27 +00:00
Daniele Varrazzo
5a65ff5cf4 Don't try to use unittest2
Modules importing unittest directly would miss the monkeypatch: see
ticket #516.
2017-03-01 20:44:04 +00:00
Daniele Varrazzo
44d8edfd8c Ignore None arguments passed to make_dsn()
Close #517.
2017-03-01 20:12:13 +00:00
Daniele Varrazzo
455f51c36c Added docs about making a release
Drop previous script which didn't include the CI-generated packages.

[skip ci]
2017-03-01 15:59:15 +00:00
Daniele Varrazzo
6f7e570a0a Bump away from 2.7
[skip ci]
2017-03-01 15:56:54 +00:00
Daniele Varrazzo
51591e2c23 Merge branch 'fix-512' 2017-03-01 02:14:40 +00:00
Daniele Varrazzo
3638d349ba Skip test on PG version with bad interval rounding
On these ancient versions:

    =# select '999999:00:00.1'::interval;
                interval
    --------------------------------
     41666 days 15:00:00.0999999046
2017-03-01 02:14:35 +00:00
Daniele Varrazzo
b0e6045b63 Bump to version 2.7
Refer to pep 440 for version numbering, which superseded pep 386. We are
not changing numbering scheme: the version numbers we have used (when we
have been consistent) would have been valid in both schemes.
2017-02-28 11:57:08 +00:00
Daniele Varrazzo
a2bc3c7bcb Fixed doc typo
Close #515
2017-02-28 11:28:11 +00:00
Daniele Varrazzo
c871c49f55 Dropped reference to "isolation level autocommit" in docs 2017-02-24 16:53:32 +00:00
Daniele Varrazzo
72f74d1f41 Dropped compiler warning on Windows 2017-02-24 13:33:42 +00:00
Daniele Varrazzo
451e1e2e73 Merge branch 'fix-512' 2017-02-24 13:33:36 +00:00