mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-26 10:53:44 +03:00
Merge pull request #614 from fogzot/fix-613
Don't cast point arrays to float arrays (fixes: #613)
This commit is contained in:
commit
13b0b9d3e3
|
@ -15,7 +15,7 @@ static long int typecast_BINARY_types[] = {17, 0};
|
||||||
static long int typecast_ROWID_types[] = {26, 0};
|
static long int typecast_ROWID_types[] = {26, 0};
|
||||||
static long int typecast_LONGINTEGERARRAY_types[] = {1016, 0};
|
static long int typecast_LONGINTEGERARRAY_types[] = {1016, 0};
|
||||||
static long int typecast_INTEGERARRAY_types[] = {1005, 1006, 1007, 0};
|
static long int typecast_INTEGERARRAY_types[] = {1005, 1006, 1007, 0};
|
||||||
static long int typecast_FLOATARRAY_types[] = {1017, 1021, 1022, 0};
|
static long int typecast_FLOATARRAY_types[] = {1021, 1022, 0};
|
||||||
static long int typecast_DECIMALARRAY_types[] = {1231, 0};
|
static long int typecast_DECIMALARRAY_types[] = {1231, 0};
|
||||||
static long int typecast_UNICODEARRAY_types[] = {1002, 1003, 1009, 1014, 1015, 0};
|
static long int typecast_UNICODEARRAY_types[] = {1002, 1003, 1009, 1014, 1015, 0};
|
||||||
static long int typecast_STRINGARRAY_types[] = {1002, 1003, 1009, 1014, 1015, 0};
|
static long int typecast_STRINGARRAY_types[] = {1002, 1003, 1009, 1014, 1015, 0};
|
||||||
|
|
|
@ -116,6 +116,11 @@ class TypesExtrasTests(ConnectingTestCase):
|
||||||
except psycopg2.ProgrammingError, err:
|
except psycopg2.ProgrammingError, err:
|
||||||
self.failUnless(str(err) == "can't adapt type 'Foo'")
|
self.failUnless(str(err) == "can't adapt type 'Foo'")
|
||||||
|
|
||||||
|
def test_point_array(self):
|
||||||
|
# make sure a point array is never casted to a float array,
|
||||||
|
# see https://github.com/psycopg/psycopg2/issues/613
|
||||||
|
s = self.execute("""SELECT '{"(1,2)","(3,4)"}' AS foo""")
|
||||||
|
self.failUnless(s == """{"(1,2)","(3,4)"}""")
|
||||||
|
|
||||||
def skip_if_no_hstore(f):
|
def skip_if_no_hstore(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user