[elephant-devel] Re: Automate "create language plpgsql;"

Alex Mizrahi killerstorm at newmail.ru
Mon Feb 25 09:00:40 UTC 2008


 LPP> At the moment this has to be done for each Postgres database used
 LPP> by Elephant. Any objections on doing this automatically if needed?

we have this:

(defun init-stored-procedures (con)
  (safe-ignore-postgres-error (con)
    (cl-postgres:exec-query con "CREATE LANGUAGE plpgsql;"))

but it fails:

alex at debetch:~$ psql -c "create language plpgsql" elepm
ERROR:  must be superuser to create procedural language

no big deal, i have a script that re-creates database:

#!/bin/bash

dropdb elepm
createdb elepm
psql -c "grant all on database elepm to alex"
psql -c "create language plpgsql" elepm

i execute it as postgres via sudo -u. 






More information about the elephant-devel mailing list