Opened 10 years ago

Closed 10 years ago

#22907 closed Bug (fixed)

ArrayField querying doesn't work with CharField

Reported by: Alexander Schepanovski Owned by: Marc Tamlyn <marc.tamlyn@…>
Component: contrib.postgres Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When trying to make query with CharArrayModel.objects.filter(field__contains=['text']) I get:

ProgrammingError: operator does not exist: character varying[] @> text[]
LINE 1: ...el" WHERE "postgres_tests_chararraymodel"."field" @> ARRAY['...
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

Change History (6)

comment:1 by Alexander Schepanovski, 10 years ago

Created a failing test in a pull request

comment:2 by Simon Charette, 10 years ago

Triage Stage: UnreviewedAccepted

I could reproduce with provided test case on PostgreSQL 9.3.4.

Interestingly I'm also getting a failure on postgres_tests.test_array.TestSaveLoad.test_dates:

ProgrammingError: column "field" is of type timestamp with time zone[] but expression is of type text[]
LINE 1: ...tgres_tests_datetimearraymodel" ("field") VALUES (ARRAY['201...
HINT:  You will need to rewrite or cast the expression.

@Suor Which version of PostgreSQL are you using?

comment:3 by Aymeric Augustin, 10 years ago

Severity: Release blockerNormal

This ticket doesn't block 1.7, probably doesn't block 1.8, and will most likely be fixed by then.

comment:5 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Marc Tamlyn <marc.tamlyn@…>, 10 years ago

Owner: set to Marc Tamlyn <marc.tamlyn@…>
Resolution: fixed
Status: newclosed

In b65a2001e7be3811903fc8769fa4d3df3d324f18:

Fixed #22907 -- Array contains must have same type.

Note: See TracTickets for help on using tickets.
Back to Top