Commit Graph

1845 Commits

Author SHA1 Message Date
Daniele Varrazzo
d3bbd19ccb Separate parse_dsn test in a test case of their own 2015-10-01 11:52:42 +01:00
Daniele Varrazzo
d1af12187c Merge branch 'master' into parse-dsn 2015-10-01 11:39:51 +01:00
Daniele Varrazzo
6803341f21 Report NotSupportedError for PGRES_COPY_BOTH and PGRES_SINGLE_TUPLE
Fixes #352.
2015-09-30 12:28:07 +01:00
Daniele Varrazzo
0e3f5214c5 Report the server response status on errors with no message
Suggested by Craig Ringer in pull request #353, should also give more
information for other cases we were reported on flaky servers (AWS,
digital ocean...), see bug #281.
2015-09-30 12:28:07 +01:00
Federico Di Gregorio
4e92322d74 Merge pull request #350 from Photonios/master
Fixes for MSVC 2015 (Python 3.5)
2015-09-23 11:50:25 +02:00
Photonios
71925fcc00 Fix for MSVC 2015: round has been added to this version 2015-09-22 18:26:14 +02:00
Photonios
ac25ba0a3f Fix for MSVC 2015: isnan is supported in this version 2015-09-22 18:25:53 +02:00
Oleksandr Shulgin
26fe1f230f Fix use of PQconsumeInput() in pq_read_replication_message()
The libpq's PQconsumeInput() returns 0 in case of an error only, but
we need to know if it was able to actually read something.  Work
around this by setting an internal flag before retry.
2015-07-07 19:04:32 +02:00
Oleksandr Shulgin
eac16d048a Fix missing GC flag in ReplicationMessage type 2015-07-03 15:44:45 +02:00
Oleksandr Shulgin
06f18237f7 Fix missing free in replmsg_dealloc 2015-07-03 11:40:00 +02:00
Oleksandr Shulgin
9c1f2acf3e Check return value of PQsocket
When connection is closed by the server, we might get -1 there.
2015-07-02 14:39:51 +02:00
Oleksandr Shulgin
dab41c699a Fix PQconsumeInput usage.
Only call when no data is available in the internal buffer.
2015-07-02 14:34:09 +02:00
Oleksandr Shulgin
9386653d72 Update docs on ReplicationCursor 2015-07-01 14:08:32 +02:00
Oleksandr Shulgin
0d731aa12e Comment on special handling of PGRES_COPY_BOTH 2015-06-30 16:34:17 +02:00
Oleksandr Shulgin
318706f28c Update docs for Replication protocol 2015-06-30 16:17:31 +02:00
Oleksandr Shulgin
058db56430 Merge remote-tracking branch 'zalando/feature/replication-protocol' into feature/replication-protocol 2015-06-30 10:40:52 +02:00
Oleksandr Shulgin
61e52ce879 Rework replication protocol
This change exposes lower level functions for operating the
(logical) replication protocol, while keeping the high-level
start_replication function that does all the job for you in
case of a synchronous connection.

A number of other changes and fixes are put into this commit.
2015-06-30 10:38:18 +02:00
Oleksandr Shulgin
e3c3a2c19e Merge branch 'master' into feature/replication-message-object
Conflicts:
	lib/extensions.py
2015-06-30 10:30:32 +02:00
Oleksandr Shulgin
9ed90b1216 Refer cursor from ReplicationMessage object. At the same time, for the sync use LSN instead of msg reference in cursor. 2015-06-11 14:52:01 +02:00
Oleksandr Shulgin
35a3262fe3 Expose ReplicationMessage type in extras 2015-06-11 12:20:52 +02:00
Oleksandr Shulgin
9fc5bf4436 Add handling of send_time field in replmsg 2015-06-10 18:21:06 +02:00
Oleksandr Shulgin
1ac385d1fb Fix logical decoding plugin options adaptation on python3 2015-06-10 13:39:35 +02:00
Oleksandr Shulgin
453830f80c Add ReplicationMessage object 2015-06-05 17:44:09 +02:00
Oleksandr Shulgin
f7b84ce843 Add {libpq,win32}_support.* to the .cproj file 2015-06-04 11:01:09 +02:00
Oleksandr Shulgin
50df864f8c Add timersub for Win32. Fix gettimeofday on MinGW. 2015-06-04 11:00:08 +02:00
Oleksandr Shulgin
f14521f8cb Add libpq_support.c and win32_support.c
Move libpq-specific code for streaming replication support into a
separate file.  Also provide gettimeofday() on Win32, implementation
copied from Postgres core.
2015-06-03 14:10:20 +02:00
Daniele Varrazzo
925fdf5731 Fixed doc about libpq version availability 2015-06-02 17:11:09 +01:00
btubbs
06b4b1de94 Notify example should pop the oldest message in conn.notifies, not the newest. 2015-06-02 17:07:10 +01:00
Daniele Varrazzo
6002c524d6 Merge branch 'notice-lists-replaceable' 2015-06-02 17:04:25 +01:00
Daniele Varrazzo
1f330e9cac Allow connection.notices and notifies to be replaced.
Close #326
2015-06-02 17:02:04 +01:00
Oleksandr Shulgin
44b705f88f Improve identify_system: don't hardcode column names 2015-06-02 16:52:48 +02:00
Daniele Varrazzo
2ad82b973b Pending notice list converted into a forward list
This allows inserting the elements in order without using list.insert().
2015-06-02 14:25:46 +01:00
Daniele Varrazzo
b326a27774 Dropped unneeded constness on the notice message
That's a strdup result, we 0wn it.
2015-06-02 14:24:48 +01:00
Daniele Varrazzo
0a7261268b Dropped unused notice_filter connection member 2015-06-02 13:11:46 +01:00
Oleksandr Shulgin
d6041271bc Separate parse_dsn test on URI, for libpq >= 9.2 2015-06-02 14:02:29 +02:00
Pete Hollobon
5712f30169 Change "non desiderable" to "undesirable" in docs
"desiderable" is considered obsolete
2015-06-02 13:00:25 +01:00
Daniele Varrazzo
7e5715617e Merge branch 'adapt-list-of-none' 2015-06-02 12:49:15 +01:00
Daniele Varrazzo
b0058c0cc8 Fixed adaptation of lists of None
Note: lists of lists of None are not supported yet.
2015-06-02 12:48:24 +01:00
Oleksandr Shulgin
cc08e14162 Merge branch 'master' into feature/parse-dsn
Conflicts:
	lib/extensions.py
2015-06-02 12:42:03 +02:00
Daniele Varrazzo
8d4ac25b56 Merge branch 'libpq-version' 2015-06-02 11:20:28 +01:00
Daniele Varrazzo
c2955fb8fc Version function/constant docs improved 2015-06-02 11:20:02 +01:00
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