Commit Graph

1831 Commits

Author SHA1 Message Date
Daniele Varrazzo
3ef995a793 Fixed REst error in newsfile 2016-12-25 20:55:15 +01:00
Daniele Varrazzo
a174b08133 Fixed intersphinx links to Pyton docs 2016-12-25 20:55:01 +01:00
Luke Nezda
c743da0405 fix wait_select sample to be extras not extensions 2016-12-25 20:49:35 +01:00
Tim Graham
0e69b4de18 Fix "invalid escape sequence" warning in Python 3.6
http://bugs.python.org/issue27364
2016-12-25 20:45:34 +01:00
Daniele Varrazzo
ecb1ef2353 Fixed tests failures on Python != 2.7 2016-12-25 20:35:18 +01:00
Daniele Varrazzo
ce0d63babb Merge branch 'fix-453' into maint_2_6 2016-12-25 20:04:01 +01:00
Daniele Varrazzo
9e4f5cb76e Added empty options in setup.cfg
Setuptools removes them from the sdist, see #453
2016-12-25 20:03:43 +01:00
Daniele Varrazzo
934f30db1b Added travis config to test branch 2.6 2016-12-25 19:55:24 +01:00
Daniele Varrazzo
9a6b7e8b10 Merge branch 'nul-terminator' into maint_2_6 2016-08-07 02:53:01 +01:00
Daniele Varrazzo
ffc0446b25 Mention NULL characters guard in NEWS file
Fix #420.
2016-08-07 02:52:43 +01:00
Alexander Schrijver
5d5159c9d0 Throw an exception when a NUL character is used as a parameter. 2016-08-07 02:52:32 +01:00
SpootDev
9477cd1505 spelling fix 2016-08-07 02:44:28 +01:00
Daniele Varrazzo
c79953656e Merge branch 'range-picklable' into maint_2_6 2016-08-07 02:38:19 +01:00
Daniele Varrazzo
cc05451461 Report range picklable in NEWS file
Fix #462
2016-08-07 02:38:09 +01:00
Jonathan Ross Rogers
60017fec0e Make Range pickleable 2016-08-07 02:32:32 +01:00
Daniele Varrazzo
dc95b0963e Bump to next dev release 2016-07-07 11:57:01 +01:00
Daniele Varrazzo
9f032ef233 Mark PG 9.5 supported 2016-07-07 04:16:55 +01:00
Daniele Varrazzo
ed912a3578 news file typo 2016-07-07 04:12:40 +01:00
Daniele Varrazzo
1690fbace1 Version bumped for released 2.6.2 2016-07-07 02:56:27 +01:00
Daniele Varrazzo
c5411f67c2 Added link from news file 2016-07-07 02:47:34 +01:00
Daniele Varrazzo
a5970a21a8 Bunch of test tweaks to make the test grid green 2016-07-04 23:01:49 +01:00
Daniele Varrazzo
98a9203827 Merge branch 'issue443' into maint_2_6 2016-07-04 22:07:41 +01:00
Daniele Varrazzo
9886a7210e Connection state fixed noted in the news 2016-07-04 22:07:28 +01:00
Daniele Varrazzo
f4b57822b0 Fixed tests on Py 2.5 2016-07-04 22:07:28 +01:00
Daniele Varrazzo
9d4e3a06b7 Skip killing test on brontosaur servers 2016-07-04 21:50:33 +01:00
Daniele Varrazzo
88af6e790c errorcodes map updated to PostgreSQL 9.5. 2016-07-01 20:08:53 +01:00
Daniele Varrazzo
5e7a4983c6 Merge branch 'bug-424' into maint_2_6 2016-07-01 19:30:01 +01:00
Daniele Varrazzo
230d9d6b1a Mention closing bug #424 in the news 2016-07-01 19:29:45 +01:00
Gabriel Kihlman
e3ba21039c Avoid a possible null deref, tz might be NULL.
Found by clang static analyzer.
2016-07-01 19:29:45 +01:00
Daniele Varrazzo
61764ea581 Allow adapting bytes using QuotedString on Python 3 too
Close #365.
2016-07-01 19:11:04 +01:00
Daniele Varrazzo
c585478dd1 Fixed encoding tests on Py3 2016-07-01 18:50:44 +01:00
Daniele Varrazzo
2b52469a0b Docs wrapping 2016-07-01 17:56:29 +01:00
Udi Oron
bbe6414ad3 Suggest installing psycopg2 in windows using pip
pip is becoming the standard method for installing python packages, and now binary wheels are a better and easier option for users:
https://github.com/psycopg/psycopg2/issues/368
2016-07-01 17:55:31 +01:00
Daniele Varrazzo
ece7fb43b5 Merge branch 'qstring-writable-encoding' into maint_2_6 2016-07-01 17:54:28 +01:00
Daniele Varrazzo
f335c46a54 Don't hope to encode stuff in an arbitrary encoding
libpq's PQescapeString will use the same encoding it has seen before in
a connection (static_client_encoding).

So I think I'll leave this feature here for people who know what is
doing, but won't really document it as a feature: it can't really work
in a generic way (unless adding some disgusting hack like creating a
fake connection with the encoding we want to call PQescapeStringConn
instead of PQescapeString).
2016-07-01 17:47:40 +01:00
Daniele Varrazzo
e062404d5c Test moved to the right module, cleanup, but same problem 2016-07-01 16:57:25 +01:00
Daniele Varrazzo
600c744fba Work in progress on writable encoding
Would help using adapt(unicode) to quote strings without a connection,
see ticket #331.

Currently in heisenbug state: if test_connection_wins_anyway and
test_encoding_default run (in this order), the latter fail because the
returned value is "'\xe8 '", with an extra space. Skipping the first
test, the second succeed.

The bad value is returned by the libpq:

    ql = PQescapeString(to+eq+1, from, len);

just returns len = 2 and an extra space in the string... meh.
2016-07-01 11:17:55 +01:00
Daniele Varrazzo
556f25153f Fixed build on win32
Fix #422.
2016-07-01 02:23:59 +01:00
Daniele Varrazzo
8dff6a38c7 Fixed segfault on repr() for uninitialized connections
Close #361.
2016-07-01 02:09:56 +01:00
Daniele Varrazzo
05f23df238 Wordsmithing on COPY commands
Address somehow issue #397.
2016-07-01 01:41:03 +01:00
Daniele Varrazzo
5f3be39e0a Document that the libpq must be available at runtime
Fix issue #408.
2016-07-01 01:21:08 +01:00
Gabriel Linder
4d0b449cbf Typo. 2016-07-01 01:21:08 +01:00
Bernhard M. Wiedemann
89f2ab9f05 dont claim copyright for future years
otherwise, when building from unchanged source in 2018,
it would claim Copyright 2018
which is not true

Being able to reproduce identical output from identical input
is important to Linux distributions
2016-07-01 01:21:08 +01:00
Federico Di Gregorio
e79949f76e Merge pull request #447 from gward/maint_2_6
Fix scattered grammar/spelling errors in comments, debug output, etc.
2016-06-29 08:38:48 +02:00
Greg Ward
077e1f0e8d Fix scattered grammar/spelling errors in comments, debug output, etc. 2016-06-28 18:16:16 -04:00
Greg Ward
53c1607644 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.
2016-06-28 18:03:05 -04:00
Greg Ward
ac14957fbb 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.
2016-06-28 17:46:21 -04:00
Karl O. Pinc
2714c9c638 Improve sentence. 2016-03-10 12:07:38 +00:00
Jan Janßen
072b6ef98b Update psycopg1.py 2016-03-10 11:58:37 +00:00
Daniele Varrazzo
5aa7588f56 Merge branch 'py35' into maint_2_6 2016-03-08 05:15:47 +00:00