Best way to install hstore on multiple schemas in a Postgres database?

It is not allowed to install extensions multiple times per database. Quoting the manual on CREATE EXTENSION: Remember that the extension itself is not considered to be within any schema: extensions have unqualified names that must be unique database-wide. But objects belonging to the extension can be within schemas. If you don’t want to include … Read more

How to create a new database with the hstore extension already installed?

Long story short: Install hstore in the template1 database: psql -d template1 -c ‘create extension hstore;’ Step-by-step explanation: As stated by the PostgreSQL documentation: CREATE EXTENSION loads a new extension into the current database. Installing an extension is database-specific. The following returns you the current database name: $ psql -c ‘select current_database()’ current_database —————— username … Read more