diff --git a/psycopg/adapter_list.c b/psycopg/adapter_list.c index e22292b6..4f8349d1 100644 --- a/psycopg/adapter_list.c +++ b/psycopg/adapter_list.c @@ -47,7 +47,7 @@ list_quote(listObject *self) /* list consisting of only NULL don't work with the ARRAY[] construct * so we use the {NULL,...} syntax. The same syntax is also necessary * to convert array of arrays containing only nulls. */ - int all_nulls = 1; + int all_nulls = 0; Py_ssize_t i, len; diff --git a/tests/test_types_basic.py b/tests/test_types_basic.py index 781dc44e..8336cab4 100755 --- a/tests/test_types_basic.py +++ b/tests/test_types_basic.py @@ -272,6 +272,8 @@ class TypesBasicTests(ConnectingTestCase): ]: curs.execute("select %s::int[]", (a,)) self.assertEqual(curs.fetchone()[0], a) + curs.execute("select array[%s]::int[]", (a,)) + self.assertEqual(curs.fetchone()[0], [a]) def testTypeRoundtripBytes(self): o1 = bytes(range(256))