From: Ants Aasma Date: Thu, 3 Jan 2008 23:38:55 +0000 (+0000) Subject: fix not calling the result processor of PGArray subtypes. (a rather embarrasing copyp... X-Git-Tag: rel_0_4_2a~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efb89f211319b19231260572422e4814639cace7;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fix not calling the result processor of PGArray subtypes. (a rather embarrasing copypaste error) [ticket:913] --- diff --git a/CHANGES b/CHANGES index d1d2a9a01c..b839ec7df1 100644 --- a/CHANGES +++ b/CHANGES @@ -14,7 +14,13 @@ CHANGES loaded collection will get cleared out if it's referenced in more than one batch, and in all cases attributes will be overwritten on instances that occur in more than one batch. - + +- dialects + + - PostgreSQL + - Fixed the missing call to subtype result processor for the PGArray + type. [ticket:913] + 0.4.2 ----- - sql diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index c21d803d3e..01b1b10d32 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -138,7 +138,7 @@ class PGArray(sqltypes.Concatenable, sqltypes.TypeEngine): return process def result_processor(self, dialect): - item_proc = self.item_type.bind_processor(dialect) + item_proc = self.item_type.result_processor(dialect) def process(value): if value is None: return value diff --git a/test/dialect/postgres.py b/test/dialect/postgres.py index 11e2c139ea..78d47ef9d5 100644 --- a/test/dialect/postgres.py +++ b/test/dialect/postgres.py @@ -658,7 +658,7 @@ class ArrayTest(AssertMixin): arrtable = Table('arrtable', metadata, Column('id', Integer, primary_key=True), Column('intarr', postgres.PGArray(Integer)), - Column('strarr', postgres.PGArray(String), nullable=False) + Column('strarr', postgres.PGArray(String(convert_unicode=True)), nullable=False) ) metadata.create_all() def tearDownAll(self): @@ -695,5 +695,14 @@ class ArrayTest(AssertMixin): self.assertEquals(results[0][0], [1,2,3,4,5,6]) arrtable.delete().execute() + def test_array_subtype_resultprocessor(self): + arrtable.insert().execute(intarr=[4,5,6], strarr=[[u'm\xe4\xe4'], [u'm\xf6\xf6']]) + arrtable.insert().execute(intarr=[1,2,3], strarr=[u'm\xe4\xe4', u'm\xf6\xf6']) + results = arrtable.select(order_by=[arrtable.c.intarr]).execute().fetchall() + self.assertEquals(len(results), 2) + self.assertEquals(results[0]['strarr'], [u'm\xe4\xe4', u'm\xf6\xf6']) + self.assertEquals(results[1]['strarr'], [[u'm\xe4\xe4'], [u'm\xf6\xf6']]) + arrtable.delete().execute() + if __name__ == "__main__": testbase.main()