I have a lovely PostgreSQL 9.0 server installed on my laptop via MacPorts. I would like to enable the hstore module, but I can’t find any instructions for installing these optional modules (nor can I find any hstore-related code in /opt/local/share/postgresql90/contrib/).
I have found some hstore-related SQL here, but I’m not sure where it comes from or if it’s compatible w/ PostgreSQL 9.0.
So, how do I enable the hstore module on my MacPorts-installed Postgres 9.0 server?
You can tell MacPorts to build hstore. Here’s how.
If you already have
postgresqlinstalled, you will need to uninstall it first (this won’t touch your data or users) because theinstallaction will not re-install an already installed port. The uninstall is forced (-f) becausepostgresql91-serveris dependent and will prevent uninstall.Edit the Portfile and add
hstoreto the list on the line which begins withset contribs:(Re)install from source explicitly (
-s) to build the hstore extension:Then load hstore, once for each of your databases in which you want to use it:
In >= 9.1:
CREATE EXTENSION hstore;In 9.0:
psql -U postgres -f /opt/local/share/postgresql90/contrib/hstore.sqlNote this process works for postgresql92 by just substituting “92” for “91”.