Commit Graph

2254 Commits

Author SHA1 Message Date
Daniele Varrazzo
5a21da43ee Mention libpq version inspection in news file 2015-06-02 11:19:55 +01:00
Daniele Varrazzo
73d17e3c5e Dropped PG_VERSION_HEX constant
At PostgreSQL 10.0 it would have become awkward.
2015-06-02 10:54:08 +01:00
Oleksandr Shulgin
80da76d43f Get rid of postgres internal includes; check for Win32 for htonl() 2015-06-02 11:42:56 +02:00
Oleksandr Shulgin
ffd98a82c0 Add test for libpq_version 2015-06-02 11:12:16 +02:00
Oleksandr Shulgin
4bb6f9cef2 Add libpq version discovery 2015-06-01 18:05:11 +02:00
Oleksandr Shulgin
3200cd77bf One more parse_dsn test for unquoted space 2015-06-01 15:18:03 +02:00
Oleksandr Shulgin
6a2f21aa14 Move parse_dsn to extensions, add tests 2015-06-01 15:11:12 +02:00
Oleksandr Shulgin
e32e1b834e Add support for streaming replication protocol
Introduce ReplicationConnection and ReplicationCursor classes, that
incapsulate initiation of special type of PostgreSQL connection and
handling of special replication commands only available in this special
connection mode.

The handling of stream of replication data from the server is modelled
largely after the existing support for "COPY table TO file" command and
pg_recvlogical tool supplied with PostgreSQL (though, it can also be
used for physical replication.)
2015-06-01 11:45:04 +02:00
Oleksandr Shulgin
6c57e4a648 Add parse_dsn module function
Calls PQconninfoParse to parse the dsn into a list of keyword and value
structs, then constructs a dictionary from that.  Can be useful when one
needs to alter some part of the the connection string reliably, but
doesn't want to get into all the details of parsing a dsn string:
quoting, URL format, etc.
2015-06-01 10:16:07 +02:00
Daniele Varrazzo
d66165232e OpenSSL deadlock fix noted in NEWSfile 2015-05-03 12:27:37 +01:00
Jan Urbański
a59704cf93 Make sure libcrypto threadsafety callbacks are properly set up
Multithreaded programs using libcrypto (part of OpenSSL) need to set up
callbacks to ensure safe execution. Both Python and libpq set up those
callbacks, which might lead to a conflict.

To avoid leaving dangling function pointers when being unloaded, libpq sets up
and removes the callbacks every time a SSL connection it opened and closed. If
another Python thread is performing unrelated SSL operations (like connecting
to a HTTPS server), this might lead to deadlocks, as described in
http://www.postgresql.org/message-id/871tlzrlkq.fsf@wulczer.org

Even if the problem will be remediated in libpq, it's still useful to have it
fixed in psycopg2. The solution is to use Python's own libcrypto callbacks and
completely disable handling them in libpq.
2015-05-03 12:27:36 +01:00
Daniele Varrazzo
1b7e3c6da4 Improve docs about connection's with only closing the transaction 2015-05-03 12:01:06 +01:00
Daniele Varrazzo
ad3e91a56f Unlock the connection after PQflush error
Apparently this has never happened... anyway the code path was wrong.

Fixes #294.
2015-05-03 12:01:05 +01:00
Daniele Varrazzo
4078b89521 Added makefile target to upload docs 2015-05-03 10:30:33 +01:00
Daniele Varrazzo
1d006ccbe9 Added note about table names to be escaped in copy_*() methods. 2015-05-03 10:30:28 +01:00
Hyunjun Kim
4eee1207f9 Fix several typos 2015-05-03 10:30:21 +01:00
Daniele Varrazzo
2cab752443 Fix to MinTimeLoggingCursor.callproc() noted in NEWSfile 2015-05-03 10:30:16 +01:00
andrew deryabin
41639c7610 Fixed MinTimeLoggingCursor.callproc() 2015-05-03 10:30:11 +01:00
Daniele Varrazzo
f27ca25d2e Wordsmith on connection.set_session()
Fixes #310.
2015-05-03 10:30:05 +01:00
Daniele Varrazzo
70fbc8bf1f Fixed connection.poll() docstring
Fixes #312
2015-05-03 10:29:57 +01:00
Daniele Varrazzo
0b523927bc Docs build process and docs cleaned up 2015-04-28 09:32:58 +01:00
Daniele Varrazzo
1e8be5bd09 Added missing files needed to build the docs
Fixes #291
2015-04-28 08:38:57 +01:00
Daniele Varrazzo
c62c292053 Bump to next dev version number for the master branch 2015-04-28 08:38:41 +01:00
Daniele Varrazzo
5efe7131ff Version bumped for release 2.6 2015-02-09 09:43:55 +00:00
Daniele Varrazzo
6d63973e08 More portable way to establish Python 32/64 build 2015-02-08 22:52:50 +00:00
Daniele Varrazzo
569fd0975b Python 3.1 bytes.decode() doesn't support keyword arguments
Sucker.
2015-02-08 19:43:09 +00:00
Daniele Varrazzo
296caa4556 More tests tweaks
Named cursors on old server versions have a different prefetch behaviour.
This has hidden me the supported range of the 24:00 time format.
Let's have another go at full testing...
2015-02-08 12:51:36 +00:00
Daniele Varrazzo
7ea56b112e Make Column picklable on Python >= 3.3
Also expose the type from the extensions module, not from the main
module.
2015-02-08 11:27:10 +00:00
Daniele Varrazzo
6177823811 Don't test date 24:00 before PG 8.4 2015-02-08 10:30:48 +00:00
Daniele Varrazzo
2a2f306f7b Added NEWS note about picklable cursor.desciption 2015-02-08 02:32:47 +00:00
Owen Raccuglia
5af5fb4cc6 Allow pickling of cursor.description
This is for people using dtuple.py; a dtuple.DatabaseTuple instance
keeps a reference to cursor.description, which is not picklable because
psycopg2 doesn't export the Column namedtuple it uses.

This commit exports the Column namedtuple, and includes a test to verify
the pickle/unpickle works after exporting Column.
2015-02-08 02:31:33 +00:00
Daniele Varrazzo
54ebf90fc6 Document that LO64 is only available on Py 64 builds 2015-02-08 02:21:22 +00:00
Daniele Varrazzo
f15e9d0cc8 Fixed link in NEWS entry 2015-02-08 02:14:00 +00:00
Daniele Varrazzo
e490e3bfa3 Accept overflow errors testing for LO64 funcs
It is raised on 32 bits by PyArg_ParseTuple. We may work around on
truncate (maybe parsing a py_ssize_t) but we would have the same problem
on seek as the offset is signed.
2015-02-08 02:04:41 +00:00
Daniele Varrazzo
7ce7fef322 Propagate read error messages in COPY FROM
Fix ticket #270.
2015-02-08 01:42:21 +00:00
Daniele Varrazzo
d3c1ad5945 Convert Postgres time 24:00 into 00:00
Fix ticket #278.
2015-02-08 00:41:50 +00:00
Daniele Varrazzo
2332f2c99e Merge branch 'timetz' 2014-12-25 15:09:15 +01:00
Daniele Varrazzo
b5ac992944 Merge branch 'lo64' 2014-12-25 15:08:02 +01:00
Daniele Varrazzo
7139187381 Large object 64 bit API quoted in news file 2014-12-25 15:07:34 +01:00
Daniele Varrazzo
a338da9c19 Fixed typo in tests 2014-12-25 15:06:18 +01:00
Daniele Varrazzo
c008f9d1ce Added documentation about the lo64 support 2014-12-25 15:06:18 +01:00
Daniele Varrazzo
bc5e2aeead Keep into account psycopg build in lo64 tests 2014-12-25 15:06:18 +01:00
Daniele Varrazzo
2f862972c9 Guard against overflows when using the lo32 api
If psycopg supports lo64 but the server doesn't the user may pass values
that would overflow the api range, resulting in:

    lo.seek((2<<30))
    *** OperationalError: ERROR:  invalid seek offset: -2147483648

Also improved the error messages and guard against INT_MIN for negative
seek offsets.
2014-12-25 15:06:18 +01:00
Daniele Varrazzo
79df47a146 Fixed mismatched types in debug print 2014-12-25 15:06:18 +01:00
Daniele Varrazzo
44219bf366 Don't try and compile lo64 support on 32 bits Python
We can't fit more than 31 bits in a long anyway.
2014-12-25 15:06:18 +01:00
Daniele Varrazzo
b2327b0fc7 Add the flag 'lo64' to the version if psycopg supports the lo_*64 api 2014-12-25 15:06:18 +01:00
Daniele Varrazzo
0205d6ca2e Use ifdef instead of if to check LO64 2014-12-25 15:06:18 +01:00
Daniele Varrazzo
91eabf5fcb Fixed check for PG version
It would have failed in PostgreSQL 10.0.
2014-12-25 15:06:18 +01:00
Blake Rouse
e5bbde9554 Check server_version before using lo_*64 functions. If less tahn 9.3 old none 64bit functions will be use. 2014-12-25 15:06:18 +01:00
Blake Rouse
cd67d3d2fe Modify truncate to use lo_truncate64. Use HAVE_LO64 define to use new lo_*64 methods. Check size of offset and length for versions without LO64. 2014-12-25 15:06:18 +01:00