Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Return unicode arrays instead of utf-8 encoded string arrays from the psycopg database backend #189

Closed
wants to merge 1 commit into from

3 participants

@hogbait

When retrieving an array from the database using the psycopg2 backend, I was surprised when the query returned a utf-8 encoded string instead of a unicode string. Since django uses unicode everywhere internally, it should enable the psycopg connection setting that automatically converts database arrays into python unicode arrays.

@akaariai
Collaborator

An added tests would be good, this would allow me to see what actually changes in behavior. The right place is in tests/regressiontests/backends/tests.py. A small sample project (or just few lines of code) showing the issue is acceptable, too.

@Suor Suor referenced this pull request in Suor/handy
Closed

model StringArrayField #8

@apollo13
Owner

No changes sine 6 months and no ticket, so closing here.

@apollo13 apollo13 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 7, 2012
  1. @hogbait
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  django/db/backends/postgresql_psycopg2/base.py
View
1  django/db/backends/postgresql_psycopg2/base.py
@@ -28,6 +28,7 @@
IntegrityError = Database.IntegrityError
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
+psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
psycopg2.extensions.register_adapter(SafeString, psycopg2.extensions.QuotedString)
psycopg2.extensions.register_adapter(SafeUnicode, psycopg2.extensions.QuotedString)
Something went wrong with that request. Please try again.