2

Hi guys so I know this question has been asked many times but the solution that have been provided doesn't seem to fix the source of my problem.

Based on what I've seen the solution is to run create extension hstore.

However, I get the error django.db.utils.ProgrammingError: type "hstore" does not exist when I'm trying to run a django test, ie python manage.py test test_function

I'm not familiar with django tests but from what I'm seeing with the codebase I am working with is that the django test is creating a test database when I run the django test command.

When I checkout what extensions are available with the test database with \dx I see that it does not have hstore. If I run create extension hstore then the hstore extension gets created. Problem is that whenever I rerun the django test, python manage.py test test_function it tells me the test database already exists and I need to delete it first otherwise the command exits. By deleting the database the extension that just got added also gets removed thus when I run python manage.py test test_function again I end up with the same error.

How do I get rid of the error? Thank you.

1

1 Answer 1

7

Turns out what I needed to do was create the hstore extension to the default template1 with:

psql template1 -c 'create extension hstore;'
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks you for sharing your solution, it saved me. For next users, "template1" should be relaplaced with the name of your database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.