Commit Graph

1831 Commits

Author SHA1 Message Date
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
Blake Rouse
e13ec67da3 Use lseek64 and ltell64 to support large object greater than 2gb in size. 2014-12-25 15:06:18 +01:00
Daniele Varrazzo
6bccb05c90 timetz adaptation documented 2014-12-25 14:57:31 +01:00
Federico Di Gregorio
85ba098cd8 Merge pull request #273 from eriklee/master
Correct exausted -> exhausted typo in exception
2014-11-17 22:36:47 +01:00
Erik Lee
e9f54a2d6e Correct exausted -> exhausted typo 2014-11-17 17:01:00 +00:00
Federico Di Gregorio
096e0729d5 Merge pull request #272 from yoloseem/timetz
Cast time into timetz when the tzinfo field is set.
2014-11-13 10:07:02 +01:00
Hyunjun Kim
4dbda02145 Cast time into timetz when the tzinfo field is set. 2014-11-13 17:32:06 +09:00
Federico Di Gregorio
0d553269d5 Merge pull request #271 from tokheim/master
Correction to type adaption example

It is OK for an adapted object to return the escaped string on 
__str__ calls but getquoted() is the canonical method.
2014-11-03 21:21:10 +01:00
Asmund Tokheim
ab4afd0e2f Correction to type adaption example, making it more transparent 2014-11-02 14:15:51 +01:00
Daniele Varrazzo
1b48033345 Don't try to close the server cursor in error state
`close()` is implicitly called by `__exit__()`, so an exit on error
would run a query on a inerr connection, causing another exception
hiding the original one. The fix is on `close()`, not on `__exit__()`,
because the semantic of the latter is simply to call the former.

Closes #262.
2014-09-16 06:57:34 +01:00
Daniele Varrazzo
48a32b766b In 2010 I couldn't speak English 2014-09-16 06:57:34 +01:00
Tomer Chachamu
6de7315210 Fix typo in docs 2014-09-01 16:29:38 +01:00
Daniele Varrazzo
b4d38c455c Don't need to build the env for a sdist
After 2.5 we are not releasing the html docs in the sdist anymore.
2014-09-01 16:29:38 +01:00
Daniele Varrazzo
7faa06ce0b Added scripts to release and upload docs 2014-09-01 16:29:38 +01:00
Daniele Varrazzo
9fdfa86200 Release notes cleanup before releasing 2.4.5 2014-08-31 03:06:50 +01:00
Daniele Varrazzo
6210af2763 Fixed excessively strict notices test
Failing with PG 9.4 because it generates other debug messages during the
test run (rehashing catalog cache).
2014-08-31 03:06:33 +01:00
Daniele Varrazzo
8e06a51884 Added plural version of the tickets role 2014-08-31 03:05:03 +01:00
Daniele Varrazzo
7d81c48849 Point tickets to GitHub instead of Lighthouse
Keep into account the numbers reshuffling: Lighthouse bugs with a number
matching a GitHub merge request are shifted ahead.
2014-08-31 03:05:03 +01:00
Daniele Varrazzo
37d80f2c03 Use the readme as PyPI desctiption 2014-08-31 02:59:49 +01:00
Daniele Varrazzo
6705e4051d Dropped creation of errcodes with missing spec field
On further inspection these names are just aliases for values already
defined: we don't need the duplication.
2014-08-28 02:17:57 +01:00
Daniele Varrazzo
ccc30e1877 Clear adapters in test to maintain reference count 2014-08-28 02:17:54 +01:00
Daniele Varrazzo
2d601ef157 Fixed memory leak with large objects
Deallocating closed large objects failed to decrement the connection
refcount. The fact the lobject is closed doesn't matter for refcount.
Issue detected by the always useful scripts/refcounter.py

With an extra bit of unrequested whitespace love.
2014-08-28 02:17:52 +01:00
Daniele Varrazzo
ea54aa77ed Added test to verify _psycopg can be imported 2014-08-28 02:17:49 +01:00
Daniele Varrazzo
54d904138d Don't import psycopg2.tz into the C extension
This makes possible to import _psycopg directly, after adding the
package directory to the pythonpath. This enables hacks such as:

    sys.path.insert(0, '/path/to/psycopg2')
    import _psycopg
    sys.modules['psycopg2._psycopg'] = _psycopg
    sys.path.pop(0)

which can work around e.g. the problem of #201, freeze that cannot
freeze psycopg2. Well, freeze cannot freeze it because it's just not
designed to deal with C extensions. At least now the frozen application
can hack the pythonpath and work around the limitation by importing
_psycopg as above and then doing the rest of the imports normally.

Keeping long-lived references to python objects is bad anyway: the
tz module couldn't be reloaded before.
2014-08-28 02:17:46 +01:00