title: hstore type not found tags: - postgresql - psql - postgres - cli - database - hstore categories: [] date: 2018-01-08 05:13:00

hstore type not found in the database. please install it from your 'contrib/hstore.sql' file

If you happen to come upon this error while using an ORM or you plain want to use hstore in postgresql

hstore isn’t enabled by default in postgresql and must be manually enabled for each database that will use it.

Installing for a single database

psql -d test -c 'create extension hstore;'

This will get you started with hstore in the ‘test’ database

Installing for all databases

Extensive hstore usage in every database might require a different approach.

Database created by default use template1 as their template. Putting hstore in the template1 template will allow all databases created from this point forward to have hstore enabled by default without further interaction.

psql -d template1 -c 'create extension hstore;'