﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28161	contrib.postgres: ArrayField(CITextField) returns string instead of list	Hendrik Richter	Simon Charette	"The following code

{{{
from django.db import models
from django.contrib.postgres.fields import ArrayField, CITextField

class Foo(models.Model):
    bar = ArrayField(models.TextField)
    baz = ArrayField(CITextField())
}}}

has this wrong behaviour:

{{{
x = Foo.objects.get(id=1)
x.bar #  => [""Foo"", ""Bar""]
x.baz #  => ""{Foo,Bar}""
}}}

This is due to https://github.com/psycopg/psycopg2/issues/268 which requires registering a new adapter for citext fields:

Use 

{{{
select typarray from pg_type where typname = 'citext';
}}}

to get the oid, then do

{{{
psycopg2.extensions.register_type(
    psycopg2.extensions.new_array_type(
        (the_returned_oid,), 'citext[]', psycopg2.STRING))
}}}

for the correct behaviour in plain psycopg2.

Django should do that automatically if any of the CI*Fields is used. Alternatively, the ArrayField should convert the result string manually to the proper list."	Bug	closed	contrib.postgres	1.11	Release blocker	fixed			Ready for checkin	1	0	0	0	0	0
