--- /dev/null
+.. change:: 4006
+ :tags: bug, postgresql
+ :tickets: 4006
+ :versions: 1.2.0b3
+
+ Made further fixes to the :class:`.ARRAY` class in conjunction with
+ COLLATE, as the fix made in :ticket:`4006` failed to accommodate
+ for a multidimentional array.
inner = self.process(type_.item_type)
return re.sub(
r'((?: COLLATE.*)?)$',
- (r'[]\1' *
- (type_.dimensions if type_.dimensions is not None else 1)),
+ (r'%s\1' % (
+ "[]" *
+ (type_.dimensions if type_.dimensions is not None else 1)
+ )),
inner
)
'VARCHAR(30)[] COLLATE "en_US"'
)
+ def test_array_type_render_str_multidim(self):
+ self.assert_compile(
+ postgresql.ARRAY(Unicode(30), dimensions=2),
+ "VARCHAR(30)[][]"
+ )
+
+ self.assert_compile(
+ postgresql.ARRAY(Unicode(30), dimensions=3),
+ "VARCHAR(30)[][][]"
+ )
+
+ def test_array_type_render_str_collate_multidim(self):
+ self.assert_compile(
+ postgresql.ARRAY(Unicode(30, collation="en_US"), dimensions=2),
+ 'VARCHAR(30)[][] COLLATE "en_US"'
+ )
+
+ self.assert_compile(
+ postgresql.ARRAY(Unicode(30, collation="en_US"), dimensions=3),
+ 'VARCHAR(30)[][][] COLLATE "en_US"'
+ )
+
+
def test_array_int_index(self):
col = column('x', postgresql.ARRAY(Integer))
self.assert_compile(