Commit Graph

467 Commits

Author SHA1 Message Date
Daniele Varrazzo
91d2158de7 Python source cleanup using flake8 2016-10-11 00:11:55 +01:00
Daniele Varrazzo
78649f8e90 Dropped use of b() "macro" and 2to3 fixer
Just use the b"" strings syntax supported from python 2.6.
2016-08-15 01:56:36 +01:00
Daniele Varrazzo
1d950748af Merge branch 'replication-protocol' 2016-08-14 21:09:54 +01:00
Daniele Varrazzo
bd95269c69 Merge branch 'master' into nul-terminator 2016-08-07 02:49:13 +01:00
Jonathan Ross Rogers
cde19c4d59 Make Range pickleable 2016-08-07 02:38:52 +01:00
Daniele Varrazzo
2a4d6027a4 Merge branch 'master' into replication-protocol
Conflicts:
	tests/testconfig.py
2016-08-07 01:53:21 +01:00
Alexander Schrijver
03824a1dba Throw an exception when a NUL character is used as a parameter. 2016-07-18 22:56:55 +02:00
Daniele Varrazzo
7566af145b Merge branch 'conn-get-parameters' 2016-07-01 20:12:01 +01:00
Daniele Varrazzo
5bcaf11f9d Allow adapting bytes using QuotedString on Python 3 too
Close #365.
2016-07-01 19:14:00 +01:00
Daniele Varrazzo
70af49c0a2 Fixed encoding tests on Py3 2016-07-01 18:50:24 +01:00
Daniele Varrazzo
4a450b63c4 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 18:02:20 +01:00
Daniele Varrazzo
2e8e61b8d4 Test moved to the right module, cleanup, but same problem 2016-07-01 18:01:16 +01:00
Daniele Varrazzo
bada1f1f8e 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 18:00:05 +01:00
Greg Ward
3ed2c54790 Fix scattered grammar/spelling errors in comments, debug output, etc. 2016-06-30 21:09:15 +01:00
Daniele Varrazzo
eb687103b4 Skip null array test on Postgres versions not supporting it 2016-03-10 12:04:41 +00:00
Oleksandr Shulgin
a7887fab07 Merge remote-tracking branch 'zalando/feature/replication-protocol' into feature/replication-protocol-c-connection-object 2016-03-08 18:56:58 +01:00
Oleksandr Shulgin
da6e061ee8 Use python-defined make_dsn() for ReplicationConnection class 2016-03-08 18:52:21 +01:00
Oleksandr Shulgin
cb7032554e Merge branch 'master' into feature/replication-protocol-c-connection-object 2016-03-04 10:52:10 +01:00
Daniele Varrazzo
c9fd828f8a Allow make_dsn to take no parameter
The behaviour of connect() is unchanged: either dsn or params must be
specified.
2016-03-03 17:09:15 +00:00
Daniele Varrazzo
7aab934ae5 Validate output result from make_dsn()
The output is not necessarily munged anyway: if no keyword is passed,
validate the input but return it untouched.
2016-03-03 17:09:15 +00:00
Daniele Varrazzo
7155d06cdc Test that the empty dsn is a valid make_dsn input 2016-03-03 17:09:15 +00:00
Daniele Varrazzo
52087a79d9 Added test suite specific for make_dsn 2016-03-03 15:31:37 +00:00
Daniele Varrazzo
2c55a1bd53 Verify that the dsn is not manipulated by make_dsn if not necessary 2016-03-03 15:07:38 +00:00
Daniele Varrazzo
1c4523f0ac Implementation of make_dsn in Python
This is equivalent to what proposed in #363, but with a much simpler
implementation.
2016-03-03 04:33:59 +00:00
Oleksandr Shulgin
5d33b39829 Fix error test for invalid START_REPLICATION command. 2016-01-21 15:56:27 +01:00
Oleksandr Shulgin
09a4bb70a1 Allow retrying start_replication after syntax or data error. 2016-01-05 12:31:57 +01:00
Daniele Varrazzo
5fd0f6c4ee Fixed race condition on import in errorcodes.lookup
Fixes #382.
2015-12-16 12:03:10 +00:00
Oleksandr Shulgin
051e6d1364 Add skip_before_libpq for test_get_dsn_parameters 2015-10-30 13:02:45 +01:00
Oleksandr Shulgin
602fefcae3 Fix typo in a new test name 2015-10-30 11:38:28 +01:00
Oleksandr Shulgin
a4cbb088fe Add connection.get_dsn_parameters() 2015-10-30 11:10:41 +01:00
Oleksandr Shulgin
fbcf99ad07 Move replication connection to C level. 2015-10-27 18:21:24 +01:00
Oleksandr Shulgin
433fb957cb Merge branch 'feature/connect2' into feature/replication-protocol 2015-10-27 17:37:18 +01:00
Oleksandr Shulgin
7aba8b3ed0 Rework psycopg2.connect() interface. 2015-10-27 17:35:57 +01:00
Oleksandr Shulgin
8b79bf43ac Drop ReplicationCursor.flush_feedback(), rectify pq_*_replication_*() interface. 2015-10-23 18:30:18 +02:00
Oleksandr Shulgin
22cbfb26d6 Actually add replication tests to the test suite. 2015-10-20 13:05:43 +02:00
Oleksandr Shulgin
0bb81fc848 Properly subclass ReplicationCursor on C level. 2015-10-19 20:00:39 +02:00
Oleksandr Shulgin
7aea2cef6e Improve async replication test. 2015-10-19 17:02:18 +02:00
Oleksandr Shulgin
4ab7cf0157 Replace stop_replication with requirement for an exception. 2015-10-19 15:42:42 +02:00
Oleksandr Shulgin
0435320f34 Fix PSYCOPG2_TEST_REPL_DSN handling. 2015-10-16 16:36:03 +02:00
Oleksandr Shulgin
cf4f2411bf Fix async replication and test. 2015-10-15 18:01:43 +02:00
Oleksandr Shulgin
d14fea31a3 Use quote_ident from psycopg2.extensions 2015-10-15 12:56:21 +02:00
Oleksandr Shulgin
8e518d4954 Merge branch 'master' into feature/replication-protocol 2015-10-15 12:27:43 +02:00
Oleksandr Shulgin
89bb6b0711 Proper unicode handling in quote_ident. 2015-10-15 11:52:18 +02:00
Oleksandr Shulgin
9295bce154 Add psycopg2.extensions.quote_ident. 2015-10-14 17:00:25 +02:00
Oleksandr Shulgin
a0b42a12ff Update stop_repl, require replication consumer to be a callable. 2015-10-14 15:15:07 +02:00
Oleksandr Shulgin
fea2260fc5 Fix stop_replication: always raise outside the loop. 2015-10-14 12:50:08 +02:00
Oleksandr Shulgin
54079072db Fix ReplicationTest: no NotSupportedError now. 2015-10-14 12:43:26 +02:00
Daniele Varrazzo
7e94ce1f14 Drop spurious notices in test
Getting some "rehashing catalog" debug messages in PG 9.4
2015-10-01 13:31:13 +01:00
Daniele Varrazzo
5afeee3613 Added unicode support to parse_dsn
Also added support for the argument as a keyword.
2015-10-01 13:20:11 +01:00
Daniele Varrazzo
71d96293ab Fixed parse_dsn tests on Python 3
On Python 3 there is no Exception.message attribute.
2015-10-01 12:03:00 +01:00