Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when using with Postgres 9.4 #99

Open
frasergraham opened this issue Mar 20, 2015 · 6 comments
Open

Errors when using with Postgres 9.4 #99

frasergraham opened this issue Mar 20, 2015 · 6 comments

Comments

@frasergraham
Copy link

I'm seeing errors using this library with Postgres 9.4. Is there a particular version of the HSTORE extension that I might need for this to work?

when accessing hstore fields in Django I get...

TypeError: string indices must be integers, not str

when using 9.4 but with the same code against 9.3 no issues.

@nemesifier
Copy link
Member

Hi,

i haven't tested on 9.4 yet, but this should not happen.

Hopefully somebody else testing on 9.4 can give us more info.

@frasergraham
Copy link
Author

What info do you need? I'll try and get it.

@nemesifier
Copy link
Member

Try to clone this repo, follow the instructions (all the steps) on how to run the unit tests, and report any error.

@caktus-philip
Copy link

@frasergraham Some of my colleagues and I have run into a similar-sounding problem. Existing installations work fine (using Postgres 9.3 and 9.4), but those of us building new installations find that our tests break with the exact same TypeError that you reported.

For the two setups that broke, adding this to our settings fixed the problem:

DJANGO_HSTORE_ADAPTER_REGISTRATION='connection'

That's from this warning in hstore doc: https://github.com/djangonauts/django-hstore/blob/master/doc/doc.asciidoc#14-limitations

I feel pretty sure I followed the preferred method of installing hstore as described (i.e. installing it on template1) because our project setup documentation explicitly says to do that, and I don't know another way to install it (I'm new to hstore). It makes me wonder if installing it on template1 is no longer sufficient to prevent this problem due to some change in Postgres or some related component like psycopg2.

BTW, I cloned the django-hstore repo and all tests pass for me. I would be interested to know if the setting above fixes your problem.

@nemesifier
Copy link
Member

@caktus-philip after having cloned the repo, do the test pass without adding DJANGO_HSTORE_ADAPTER_REGISTRATION='connection' or did you have to add it in the local_settings.py?

@caktus-philip
Copy link

I didn't have to use DJANGO_HSTORE_ADAPTER_REGISTRATION='connection' in the django-hstore code to get it to pass. I did have to add django to requirements.txt.

$ git diff
diff --git a/requirements.txt b/requirements.txt
index d0db9c6..9e45a4e 100755
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,3 @@
 psycopg2>=2.4.3
 django-discover-runner==1.0
+Django==1.7.7

FWIW I used python runtests.py --settings=settings_psycopg. Also, I'm on OS X; my colleague who is seeing this failure is on Ubuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants