Daniele Varrazzo
28c489f17e
Merge branch 'no-set-default-session'
2017-02-07 00:58:54 +00:00
Daniele Varrazzo
7485fabe4f
Fixed BEGIN; SET TRANSACTION with PG 7.4
2017-02-07 00:58:29 +00:00
Daniele Varrazzo
3fbff5d848
Give precedence to '__conform__()' over superclasses choosing adapter
...
Close #456
2017-02-05 11:54:50 +01:00
Daniele Varrazzo
9054eeccc0
Set default_transaction_* GUC if session state is changed in autocomit
2017-02-04 15:19:41 +00:00
Daniele Varrazzo
c60682c230
Reuse set_session to implement autocommit, set_isolation_level
2017-02-04 13:26:43 +00:00
Daniele Varrazzo
8527144173
Better separation between interface and state change code
...
The state change function has a C callable signature.
2017-02-04 13:01:11 +00:00
Daniele Varrazzo
c1e016e597
Don't use default_transaction_* for session characteristics
...
Store the state in the connection object and set the params on BEGIN
Some tests fail: a few can be fixed reading transaction_* instead of
default_transaction_*; but the behaviour of tx characteristics with
autocommit is effectively changed. It may be addressed by setting
default_transaction_* if autocommit is set.
2017-02-04 02:38:56 +00:00
Daniele Varrazzo
9863637f30
Dropped compiler warning in debug mode
2017-02-04 02:32:26 +00:00
Daniele Varrazzo
de8b335d80
Merge branch 'master' into sql-compose
2017-02-03 04:56:02 +00:00
Daniele Varrazzo
ce9be69615
Added async_ as an alias for async
...
Added in argument for psycopg2.connect() and connection.__init__, and
for the connection.async attribute.
2017-02-03 04:43:49 +00:00
Daniele Varrazzo
828415d476
Typo: composible -> composable
2017-01-01 06:32:18 +01:00
Daniele Varrazzo
600416aafc
Fixed sql stuff in Py3
2017-01-01 05:59:21 +01:00
Daniele Varrazzo
c4a67fc1c1
Added sql.compose() implementation
2017-01-01 05:23:42 +01:00
Daniele Varrazzo
449bd4485f
Merge branch 'fast-codecs'
2016-12-29 22:15:46 +01:00
Daniele Varrazzo
cb5293be1f
Use the proper API functions to look up codec functions
2016-12-29 22:11:58 +01:00
Daniele Varrazzo
3295beb777
Don't look up for Python encoding
...
Store the encode/decode functions for the right codec in the connection.
The Python encoding name has been dropped of the connection to avoid the
temptation to use it...
2016-12-29 22:11:58 +01:00
Daniele Varrazzo
a81f12f9bd
Don't set tp_compare on Python 3
...
The slot is unused in Py < 3.5, and replaced by pg_as_async in Py 3.5.
2016-12-29 21:43:04 +01:00
Daniele Varrazzo
dfe547856e
Use -1 instead of 0 to say "calculate the length" in many funcs
...
0 is a valid length, isn't it?
2016-12-27 00:29:01 +01:00
Daniele Varrazzo
a255e4e1c6
Store python encoding and decoding functions in the connection
...
Unused for now: will be used instead of 'pyenc', which is to be dropped.
2016-12-27 00:29:01 +01:00
Daniele Varrazzo
17a74cc771
Setting connection encoding refactored
...
Code paths to read encoding on connection and to store the new
connection in the structure after changing it in the backend unified
into a single function.
2016-12-26 16:51:22 +01:00
Daniele Varrazzo
f439ca61d6
conn->codec rename to pyenc
2016-12-26 12:25:13 +01:00
Daniele Varrazzo
7caba160b7
Merge branch 'master' into fast-codecs
2016-12-26 12:06:21 +01:00
Daniele Varrazzo
ffeb7001eb
Fixed refcount problems in named callproc
2016-12-26 04:12:18 +01:00
Daniele Varrazzo
1957389bea
Merge branch 'master' into named-callproc
2016-12-26 03:19:02 +01:00
Daniele Varrazzo
a53b39efe8
Dropped internal escape identifier function
...
Using libpq one as now it's guaranteed to be present.
2016-12-26 03:11:36 +01:00
Daniele Varrazzo
faaef61c27
Merge branch 'master' into named-callproc
2016-12-26 01:49:42 +01:00
Daniele Varrazzo
e27579292a
Avoid deadlock on close if set datestyle failed
2016-12-25 17:45:01 +01:00
Daniele Varrazzo
c2d405116b
Dropped testing print
2016-12-25 17:44:25 +01:00
Christoph Moench-Tegeder
fb1dbc2a9b
do not "SET datestyle" on replication connections
...
A replication connection - marked by the use of the keyword "replication"
in the DSN - does not support SET commands. Trying to sent "SET datestyle"
will result in an exception.
2016-10-21 15:32:11 +02:00
Daniele Varrazzo
121cf3b8f8
Optimize UTF8 and Latin1 decoding
...
Cache a pointer to a fast decoding function when the connection encoding
is set so skip a repeated codec lookup for every string.
2016-10-12 01:10:31 +01:00
Daniele Varrazzo
584c7e6890
Dropped compiler warning in debug mode
2016-10-12 00:28:25 +01:00
Daniele Varrazzo
706ad2f177
Conver network array types into array of strings by default
2016-10-11 02:31:45 +01:00
Daniele Varrazzo
5ddc952dbb
Dropped ifdef guards against obsolete libpq versions
...
One of them was actually wrong: lobject_type.c wouldn't have compiled
pre 8.3 (broken in 6e841a41
, 2 years ago).
2016-08-15 02:55:44 +01:00
Daniele Varrazzo
3d4f6df0de
Enforce dependency on libpq version >= 9.1
...
PGRES_COPY_BOTH was introduced in 9.1: we can ifdef the hell out of
pgpath, but we may as well bury the dead horses instead of beating
them.
They smell funny, too.
2016-08-15 02:55:43 +01:00
Daniele Varrazzo
3b41c3a6f3
Stop compiling with Python 2.5
2016-08-15 01:06:42 +01:00
Daniele Varrazzo
1d950748af
Merge branch 'replication-protocol'
2016-08-14 21:09:54 +01:00
Daniele Varrazzo
e5390fed98
Use inttypes.h definitions
2016-08-14 19:48:31 +01:00
Daniele Varrazzo
12ecb4b2ce
Dropped import of postgres internal/c.h
...
Stops warning (caused by command line definition of PG_VERSION, so it
could have been avoided otherwise), but the file comment says:
Note that the definitions here are not intended to be exposed to clients
of the frontend interface libraries --- so we don't worry much about
polluting the namespace with lots of stuff...
so it doesn't seem a good idea gulping it.
2016-08-14 19:36:48 +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
e41bff8ca4
Merge branch 'bug-424'
2016-07-01 19:28:02 +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
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
Daniele Varrazzo
7aedc61d41
Fixed segfault on repr() for uninitialized connections
...
Close #361 .
2016-07-01 02:11:21 +01:00
Greg Ward
3ed2c54790
Fix scattered grammar/spelling errors in comments, debug output, etc.
2016-06-30 21:09:15 +01:00
Oleksandr Shulgin
d5443c65fd
Fix TODOs in ReplicationMessage inline docs
2016-04-21 15:32:05 +02:00
Gabriel Kihlman
5ce00f8e5b
Avoid a possible null deref, tz might be NULL.
...
Found by clang static analyzer.
2016-04-18 17:28:50 +02:00
Daniele Varrazzo
65ec7e8bcb
Fixed read() exception propagation in copy_from
...
Close issue #412 .
2016-03-10 12:13:52 +00:00
Daniele Varrazzo
8611d91b35
Fixed build on Python 2.5
2016-03-10 12:06:28 +00:00
Daniele Varrazzo
c13956dc10
Fixed compiler warnings about Py_ssize_t printf format
2016-03-10 12:02:23 +00:00
Jason Erickson
d0309333b7
Removed added Dprintf statements
...
Removed extra Dprintf statements added to trouble large objects
2016-03-10 12:02:06 +00:00
Jason Erickson
2cdc8d61a2
Fix Windows 64bit lobject support for very (>2GB) large objects
...
The type 'long' with Windows Visual C is 32bits in size for both 32bit and 64bit platforms. Changed type of variables that could be > 2GB from long to Py_ssize_t.
2016-03-10 12:02:00 +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
2de2ed7c63
Remove some dead code
2016-03-08 18:52:29 +01:00
Oleksandr Shulgin
1d52f34e60
We don't need to expose cursor_init(), call tp_init() on the type instead.
2016-03-08 18:52:21 +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
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
d40f81865f
Added parse_dsn() docstring
2016-03-03 03:25:47 +00:00
Oleksandr Shulgin
09a4bb70a1
Allow retrying start_replication after syntax or data error.
2016-01-05 12:31:57 +01:00
mrmilosz
0772d187e9
Return input tuple in cur.callproc, factor code to use PQescapeIdentifier in single place
2015-12-13 01:10:03 -05:00
Daniele Varrazzo
92109e4bba
Correctly handle an empty error message from PQescapeIdentifier
2015-12-12 17:52:56 -05:00
Daniele Varrazzo
54e5349f53
Set an exception in case of PQescapeIdentifier error
...
Ifdeffed surface reduced.
2015-12-12 17:52:56 -05:00
Daniele Varrazzo
4003b7c977
Fixed callproc return value refcount
...
Temporary anyway: I want to go back returning a list (or dict).
2015-12-12 17:51:45 -05:00
Daniele Varrazzo
021f6d22ad
More straightforward param refcount handling in callproc
2015-12-12 17:51:45 -05:00
Daniele Varrazzo
d297976d6d
Raise TypeError if the dict in callproc param contains non-strings
...
Check-and-conversion chain fixed and simplified. 'spname' was a
reference leak.
2015-12-12 17:51:08 -05:00
Daniele Varrazzo
a3eed9c9f5
Added guard on params with no length on callproc
2015-12-12 17:51:08 -05:00
Daniele Varrazzo
04ce14b251
Avoid clobbering the exceptions raised by other calls
2015-12-12 17:49:59 -05:00
mrmilosz
c205f140a0
callproc: tests, docs, and comment/error-reporting touchups.
2015-12-12 17:49:59 -05:00
mrmilosz
37a80e9de8
callproc: checking for libpq 9.0+ on compile. yes: use PQescapeIdentifier. no: error
2015-12-12 17:49:44 -05:00
mrmilosz
3948e909e4
callproc: now more compliant with local coding standards.
2015-12-12 17:49:44 -05:00
mrmilosz
e9bb4a86f9
cursor.callproc: added a missing memory check
2015-12-12 17:49:25 -05:00
mrmilosz
31c95c0922
callproc using a dict now uses connection encoding and sanitizes parameter names
2015-12-12 17:49:25 -05:00
mrmilosz
1205bf9c2b
callproc using a dict now has a type check to make sure the keys are strings.
2015-12-12 17:49:25 -05:00
mrmilosz
23d279945f
cursor.callproc now also accepts dict for PostgreSQL 9+ "named notation"
2015-12-12 17:49:25 -05:00
Oleksandr Shulgin
e61db578cf
Add dbname=replication for physical replication type.
2015-10-30 13:00:55 +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
4b9a6f48f3
Merge branch 'master' into feature/replication-protocol
2015-10-27 12:16:41 +01:00
Oleksandr Shulgin
fe4cb0d493
Fix stale Dprintfs in pqpath.c referring to 'status'
2015-10-26 17:40:39 +01:00
Oleksandr Shulgin
8b79bf43ac
Drop ReplicationCursor.flush_feedback(), rectify pq_*_replication_*() interface.
2015-10-23 18:30:18 +02:00
Oleksandr Shulgin
e69dafbecc
Move the decode
parameter to start_replication()
.
...
It makes more sense this way, because otherwise it must be passed to every call
of `read_message()`.
2015-10-23 11:31:55 +02:00
Oleksandr Shulgin
76c7f4a0b5
Use direct call to consume() callable in pq_copy_both()
2015-10-22 16:17:08 +02:00
Oleksandr Shulgin
089e745af6
Fix cursor_init() declaration for use in replication_cursor_type.c
2015-10-20 12:55:43 +02:00
Oleksandr Shulgin
b3f8e9adb5
Fix send_time printf format in replmsg_repr().
2015-10-20 12:54:22 +02:00
Oleksandr Shulgin
23abe4f501
Add quick start to the replication doc, minor doc fixes.
2015-10-20 12:36:13 +02:00
Oleksandr Shulgin
0bb81fc848
Properly subclass ReplicationCursor on C level.
2015-10-19 20:00:39 +02:00
Oleksandr Shulgin
4ab7cf0157
Replace stop_replication with requirement for an exception.
2015-10-19 15:42:42 +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
9ab38ee8c5
Add psyco_curs_datetime_init
2015-10-14 18:39:48 +02:00
Oleksandr Shulgin
28a1a00d1c
Remove commented copy_both code in pqfetch.
2015-10-14 18:39:20 +02:00
Oleksandr Shulgin
822d671e8b
Clear repl_stop flag after the consume loop.
2015-10-14 17:40:39 +02:00
Oleksandr Shulgin
e05b4fd267
Add checks on replication state, have to have a separate check for consume loop.
2015-10-14 17:36:50 +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