I'm trying to make the jump to running my Drupals on PostgreSQL, but one hurdle that I'm encountering is the need to enable plpgsql. It is, at first glance, an easy matter; one just runs the following command:

createlang plpgsql databasename

The first problem is, my user doesn't have permission to do this in my managed hosting environment. While my server admin is very friendly and installs things for me anytime I ask (including recompiling PHP to include PostgreSQL support), he isn't really enthusiastic about having to open a shell for me every time I make a database (nor am I enthusiastic about having to ask and wait every time). Are there other solutions? Does anyone here run PostgreSQL in a managed hosting environment? Is there a way to run this command for a batch of databases, or to configure PostgreSQL to enable the language by default when a new database is created?

Thanks,

Robert

Comments

robertDouglass’s picture

I'll issue a support request for this as well.

- Robert Douglass

-----
visit me at www.robshouse.net

sumbry’s picture

Create a new database template in pgsql by creating a new database. Login to the new database and then run the commands for plpgsql. Then, whenever you want to create a new database, call create database as below:

create database newdb WITH TEMPLATE = 'plpgsql-template';

By default Postgres makes new databases by cloning the template1 db, so if you add anything to the template1 db, then it'll automatically get added to any databases you create. You can use this to basically setup a bunch of different database templates w/different options and use them to generate new dbs.

robertDouglass’s picture

My host wasn't particularly reluctant to install plpgsql once for me, but was clear that he couldn't do it for every database, which seems necessary otherwise. Your tip is just what I needed.

- Robert Douglass

-----
www.robshouse.net
www.webs4.com