]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add test for inserting PG array w/ NULL, references #3916
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 16 Feb 2017 18:00:28 +0000 (13:00 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 16 Feb 2017 18:00:28 +0000 (13:00 -0500)
Change-Id: I87be274c1ba019b41744a5a76c1b5e9334564ec8

test/dialect/postgresql/test_types.py

index ddc121a8bfc4b68b29ac2e832ca7bfdd6ace7e0d..3f2f6db3f7035efa168a02189a0540b8827398d3 100644 (file)
@@ -1064,6 +1064,15 @@ class ArrayRoundTripTest(fixtures.TablesTest, AssertsExecutionResults):
         eq_(results[0]['intarr'], [1, 2, 3])
         eq_(results[0]['strarr'], [util.u('abc'), util.u('def')])
 
+    def test_insert_array_w_null(self):
+        arrtable = self.tables.arrtable
+        arrtable.insert().execute(intarr=[1, None, 3], strarr=[util.u('abc'),
+                                                            None])
+        results = arrtable.select().execute().fetchall()
+        eq_(len(results), 1)
+        eq_(results[0]['intarr'], [1, None, 3])
+        eq_(results[0]['strarr'], [util.u('abc'), None])
+
     def test_array_where(self):
         arrtable = self.tables.arrtable
         arrtable.insert().execute(intarr=[1, 2, 3], strarr=[util.u('abc'),