]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix not calling the result processor of PGArray subtypes. (a rather embarrasing copyp...
authorAnts Aasma <ants.aasma@gmail.com>
Thu, 3 Jan 2008 23:38:55 +0000 (23:38 +0000)
committerAnts Aasma <ants.aasma@gmail.com>
Thu, 3 Jan 2008 23:38:55 +0000 (23:38 +0000)
CHANGES
lib/sqlalchemy/databases/postgres.py
test/dialect/postgres.py

diff --git a/CHANGES b/CHANGES
index d1d2a9a01c6b18524f139283f1c6c9ff7067f7f6..b839ec7df14e36b57773bf061d08e3e46f88e418 100644 (file)
--- 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
index c21d803d3e8b53e87460179eb81023444b5a0b2d..01b1b10d32805d27af52e114bf08541bb3d3f6e6 100644 (file)
@@ -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
index 11e2c139ea326be018f112fef973ed896cf838b8..78d47ef9d5d3096fb730e41618f0888ab478d362 100644 (file)
@@ -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()