Daniele Varrazzo
9148157697
Merge branch 'master' into https
2018-10-10 22:07:33 +01:00
Daniele Varrazzo
cd9d74c462
Merge branch 'conn-get-host'
2018-10-10 22:03:36 +01:00
Federico Di Gregorio
81addddaee
Added connection.get_native_connection()
2018-10-07 13:54:24 +02:00
Marco De Paoli
1c553bb703
Added connection.host
...
Return the server host name of the current connect.
2018-10-06 15:19:01 +02:00
Daniele Varrazzo
4e0b2ec9c9
Added Diagnostics.severity_nonlocalized attribute
...
Close #783 .
2018-10-04 16:13:46 +01:00
Federico Di Gregorio
ccae5cae34
Expose PGconn* raw pointer on the connection as a PyCapsule
2018-09-27 10:15:40 +02:00
Jon Dufresne
b07e34e0b8
Prefer https:// URLs when available
2018-09-22 19:02:33 -07:00
Dmitry Marakasov
5ec573c83b
Remove obsolete and incorrect FreeBSD version condition
...
The FreeBSD-related condition which enables custom round() implementation is incorrect: one must include <sys/param.h> to get __FreeBSD_version value, and since it's not included here, the check succeeds while it shouldn't. Before it worked somehow, but since python 3.7 it results in conflicting declarations of round(). The condition is also no longer needed since FreeBSD 5.3 is unsupported for 12 years.
2018-09-07 23:57:33 +01:00
Daniele Varrazzo
782fa39647
Generating the whole errors file from script
2018-08-17 02:00:40 +01:00
Daniele Varrazzo
ce1ac3aea9
Read exceptions to raise from a Python module
2018-08-17 02:00:01 +01:00
Daniele Varrazzo
97a4fb92c6
Fixed compile error on windows
...
Because const int + 1 is not const, right???
Also fixed other occurrences of magic numbers and failed DRY around
PyOS_snprintf() calls.
2018-07-24 21:16:36 +01:00
Daniele Varrazzo
6d8f4f9f0d
Close named cursor if exist, even if we didn't run execute
...
Close #746
2018-07-24 21:16:36 +01:00
Daniele Varrazzo
9cf658ec6e
Fixed refcount handling in encrypt_password
...
Added tests to check bad types, which discovered the above problem: on
type error we would have decref'd on exit something that was only
borrowed (because we wouldn't have performed matching increfs).
2018-05-20 21:18:36 +01:00
Daniele Varrazzo
abca14d601
Fixed keywords support for encrypt_password and tests completed
2018-05-20 20:50:04 +01:00
Daniele Varrazzo
a3063900ee
Fixed code flow in encrypt_password()
...
Fixed several shortcomings highlighted in #576 and not fixed as
requested.
Also fixed broken behaviour of ignoring the algorithm if the connection
is missing.
2018-05-20 19:18:42 +01:00
Daniele Varrazzo
0161d54dbb
Merge branch 'master' into encrypt-pass
2018-05-20 17:57:34 +01:00
Daniele Varrazzo
068b15c57f
Merge branch 'fix-716'
2018-05-20 17:00:13 +01:00
Daniele Varrazzo
c4da939909
Don't raise an exception closing an unused named cursor
...
Close #716
2018-05-20 14:00:09 +01:00
Daniele Varrazzo
3f389593f5
Raise NotSupportedError fetching iso_8601 intervals
...
Previously it would have failed parsing and resulted in ValueError
Close #707
2018-05-20 13:22:38 +01:00
Daniele Varrazzo
b5e4a040f8
Fixed adaptation of arrays of arrays of nulls
...
Close #325 , close #706 .
2018-05-18 12:10:20 +01:00
Ashesh Vashi
36f0db81d2
Fixed the string format error reported by Travis-CI.
...
Reference: https://travis-ci.org/psycopg/psycopg2/jobs/376288585
2018-05-08 15:29:16 +05:30
Ashesh Vashi
1bec2bdc43
Merge branch 'master' into master
2018-05-08 15:17:59 +05:30
Daniele Varrazzo
ea923b63a4
Allow strings subclasses in ensure_bytes
...
Fix #679
2018-02-21 10:27:28 +00:00
Daniele Varrazzo
32f5a9fc1d
Avoid quoting the string in the psycopg version macro
...
Use a macro trick to add the quotes. This seems more portable than
passing the quotes to the command line (see #658 ).
https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html
2018-02-19 13:53:50 +00:00
Mike Gerdts
f766d90704
Fixed building on SmartOS
...
timeradd is missing on Solaris 10, but is present as a macro in
<sys/time.h> on SmartOS, illumos, and likely Solaris 11.
2018-02-19 11:40:05 +00:00
Daniele Varrazzo
5309da117d
Autocommit shouldn't change deferrable on servers not supporting it
...
Regression on unsupported Postgres versions after fixing bug #580
2018-02-08 15:00:38 +00:00
Daniele Varrazzo
74d2c4bef9
Fixed idempotence check changing connection characteristics
2018-01-11 02:23:27 +00:00
Daniele Varrazzo
e0226fc46a
'cursor.mogrify()' can be called on closed cursors
...
Fix #579 .
2018-01-11 08:55:31 +09:00
Daniele Varrazzo
bad9b8b383
Merge branch 'macro-accessors'
2018-01-10 22:47:59 +00:00
Daniele Varrazzo
77c703395b
Moved datatime compatibility macros with others
2018-01-10 22:29:16 +00:00
Ronan Amicel
b8f2f71819
Fix typo in comment in utils.c
2017-12-14 14:00:36 +01:00
Glyph
3fcb035126
define a "polyfill" inline for python 2 compatibility
2017-12-12 03:15:21 -08:00
Glyph
852884e086
use accessor macros for pypy3 compatibility
2017-12-12 03:06:18 -08:00
Jon Dufresne
e335d6d223
Trim trailing whitespace from all files throughout project
...
Many editors automatically trim whitespace on save. By trimming all
files in one go, makes future diffs cleaner without extraneous
whitespace changes.
2017-12-01 21:42:14 -08:00
Daniele Varrazzo
65ed5478d1
Collect rowcount in executemany even when discarding results
...
Closes #633 .
2017-11-29 15:42:04 +00:00
Hugo
60b1517c55
Add news and update version check
2017-11-28 16:11:02 +00:00
Hugo
ffcc65d4f0
Drop support for EOL Python 2.6
2017-11-28 16:02:12 +00:00
Daniele Varrazzo
1959d2403f
Merge branch 'solaris-support'
2017-11-28 03:16:04 +00:00
Federico Di Gregorio
5983b96c55
Don't cast point arrays to float arrays ( fixes : #613 )
2017-11-16 10:07:27 +01:00
My Karlsson
f54783ae6e
Emulate timeradd and timersub on Solaris
...
Solaris does not have timeradd and timersub. Add solaris_support.c which
provides emulated versions of them on Solaris.
2017-10-26 20:21:30 +02:00
Ashesh Vashi
84d405894c
Moving the encrypt_password method from the connection class to the
...
psycopgmodule, and exported it from psycopg2.extensions as per review
comments.
2017-09-14 23:42:54 +05:30
Ashesh Vashi
6e0edf7779
Merge remote-tracking branch 'psycopg2/master'
2017-09-11 18:26:34 +05:30
Daniele Varrazzo
775de754cf
Added back timestamptz[] default cast
...
It was registered as side effect of an excessive definition that got
cleaned up in 338dbe70a6
.
Looking at other removed redundant type oids, this was the only one
missing from the `string_types` map.
Close #578 .
2017-07-24 14:23:36 +01:00
Ashesh Vashi
78eb80d0cf
Using 'Text_FromUTF8' macro for transforming the encrypted C string to
...
Python string to make it Python 3 compatible.
2017-07-17 10:54:52 +05:30
Ashesh Vashi
cfb0937605
Added support for preparing the encrypted password of a PostgreSQL
...
password using the libpq functions - 'PQencryptPasswordConn', and
'PQencryptPassword'.
2017-07-17 10:32:59 +05:30
Daniele Varrazzo
1a97445471
Accept Composable in start_replication_expert()
...
Close #554
2017-06-17 03:30:44 +01:00
Daniele Varrazzo
49ce622a86
Fixed parsing interval from micros on 32 bit
...
Using integers the wrong size. Faithfully segfaulting since 1970.
2017-06-17 01:36:39 +01:00
Daniele Varrazzo
315f72862c
Parse a number as microseconds when casting interval
...
Should close #558 , but I'm curious to know if a number is returned
for interval < 1 day too (which wouldn't trigger the overflow, but will
finish parsing with part=0).
2017-06-16 00:54:38 +01:00
Daniele Varrazzo
338dbe70a6
Dropped wrong associations of PG types to datetime object
...
The wrong associations are overwritten in the typecaster map by the
right ones, so they have been harmless to date, but only because of the
order of creation of the adapters.
2017-06-15 18:24:25 +01:00
Daniele Varrazzo
602c74faa6
Check return code from decoding the connection status
...
It fails on Py3 after receiving a SIGABRT. Because we don't handle it
here it will resurface later with nonsense such as:
SystemError: <some function> returned a result with an error set
Close #551
2017-06-15 17:33:05 +01:00
Daniele Varrazzo
6e5abf33f2
Merge branch 'fix-547'
2017-04-19 01:34:39 +01:00
Daniele Varrazzo
a7e3f46431
Merge remote-tracking branch 'fix_lobject_factory'
2017-04-19 01:06:24 +01:00
Daniele Varrazzo
248e653c9e
Fixed args parsing in ReplicationCursor.consume_stream()
...
Close #547 .
2017-04-19 01:01:59 +01:00
Frazer McLean
7b3ea43e92
Handle lobject mode=None correctly
2017-04-16 03:20:31 +02:00
Frazer McLean
38cd720369
Fix name of lobject keyword argument
2017-04-16 03:12:18 +02:00
Daniele Varrazzo
a66c34a6d0
Don't clobber a Python exception with an unknown error
...
Close #410
2017-04-05 14:54:07 +01:00
Daniele Varrazzo
7214c6652e
Return objects with timezone parsing infinity timestamptz
...
Close #536 .
2017-03-22 03:03:02 +00:00
Daniele Varrazzo
ba0329fb40
replication connection init refactored to use psyco_make_dsn
...
Some extra bonus refactoring to improve the function readability (don't
reuse names for variables with different refcount rules, don't pass
separate obj/self, async pass-through...)
2017-03-16 03:55:22 +00:00
Daniele Varrazzo
9f160fd820
Obscure the password on url dsn too
...
Note that we don't leak anymore the password length.
Fix #528
2017-03-16 03:53:40 +00:00
Daniele Varrazzo
103655d670
Password scrubbing refactored in a separate function
2017-03-15 16:04:45 +00:00
Greg Ward
12317557da
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.
2017-03-14 12:14:00 +00:00
Greg Ward
b203a7c775
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.
2017-03-14 12:08:03 +00:00
Daniele Varrazzo
26bd5df048
Don't use PG_INT64_TYPE
...
Only defined in Postgres 9.3
Should close #520 , but let's wait for the CI response (build on
Windows etc.)
2017-03-02 19:32:39 +00:00
Daniele Varrazzo
72f74d1f41
Dropped compiler warning on Windows
2017-02-24 13:33:42 +00:00
Daniele Varrazzo
691df4952b
Handle overflow in interval parsing
2017-02-24 13:23:56 +00:00
Daniele Varrazzo
3b665d35d5
Make sure to use 64 bits in interval parsing accumulators
2017-02-24 12:10:54 +00:00
Daniele Varrazzo
834e9996da
Parse interval only using integers
...
(almost... except for micros rounding)
While this is probably an improvement on the previous implementation,
I am largely waving a dead chicken at windows, which keeps failing to
pass the seconds overflow test. If it doesn't pass now either I'll start
blaming Python's timedelta.
2017-02-24 03:48:41 +01:00
Daniele Varrazzo
a15dfbbd4f
Try to fix the same problem in windows
...
Previous commit doesn't pass on Windows: it looks like window's floor()
has an integer overflow.
2017-02-24 02:41:34 +01:00
Daniele Varrazzo
14fe3ad8c9
Fixed integer overflow in interval typecaster
...
Close #512 .
2017-02-24 02:10:27 +01:00
Daniele Varrazzo
61101888e4
Revert default_transaction_* to default only if set
...
When moving from autocommit True -> False reset only the server
parameters that were actually specified by psycopg to honour the
serssion characteristics.
2017-02-16 13:15:14 +00:00
Daniele Varrazzo
d7bba865f3
Check for deferrable unsupported applied to attribute too
2017-02-16 13:14:45 +00:00
Daniele Varrazzo
d50ed48807
Added readonly and deferrable attributes
2017-02-16 12:46:35 +00:00
Daniele Varrazzo
b5d80b609d
Revert pre-2.7b1 behaviour of silent rollback on conn.set_isolation_level()
...
Legacy method is legacy.
2017-02-16 12:46:35 +00:00
Daniele Varrazzo
20c9c17457
connection.isolation_level is now writable
2017-02-16 12:46:35 +00:00
Jason Erickson
32e81a27b5
Allowed inittype.h's defs all versions of MSVC
...
Apparently only MSVC 2015 x64 had defined these types. Changed check to
work for all versions of MSVC. Does not affect 2015x64.
2017-02-10 10:14:17 -07:00
Jason Erickson
7493ea24f2
Defined inttypes.h for older MSVC compilers
...
Older MSVC compilers do not support the C99 standard
2017-02-09 22:27:18 -07:00
Jason Erickson
d52e9100d2
Added support for MSVC compiler
...
Added function 'timeradd'.
Changed second parameter of 'gettimeofday' to void since not used in
function and MSVC timezone definition is not a struct).
2017-02-09 20:57:54 -07:00
Jason Erickson
83cf908c88
Fixed MSVC compiler error and warning
...
MSVC doesn't like referencing new initialized variables in the variable
declaration section.
2017-02-09 20:54:29 -07:00
Daniele Varrazzo
d2cd1236a8
Dropped compiler warning about signed/unsigned comparisons
2017-02-08 08:44:08 +00:00
Daniele Varrazzo
3e12522bc9
Don't convert '{}'::unknown into an empty list
...
Close #506 .
2017-02-08 08:43:53 +00:00
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
Oleksandr Shulgin
fea2260fc5
Fix stop_replication: always raise outside the loop.
2015-10-14 12:50:08 +02:00
Oleksandr Shulgin
0233620c26
Rework replication connection/cursor classes
2015-10-01 19:33:27 +02:00
Oleksandr Shulgin
937a7a9024
Cleanup start replication wrt. slot type a bit.
2015-10-01 19:33:16 +02:00
Oleksandr Shulgin
f872a2aabb
Remove typedef for uint32, include internal/c.h
2015-10-01 19:33:12 +02:00
Oleksandr Shulgin
862eda10c2
Merge remote-tracking branch 'origin/master' into repl
2015-10-01 19:29:17 +02:00
Daniele Varrazzo
c73c1c5771
Decref the ssl module after importing
2015-10-01 17:04:29 +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
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
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
0d731aa12e
Comment on special handling of PGRES_COPY_BOTH
2015-06-30 16:34:17 +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