[postgis-users] problems with 2.1.2 and new databases

Mike Toews mwtoews at gmail.com
Thu Apr 10 14:20:48 PDT 2014


On 11 April 2014 02:23, jamo3 <jaymoss3 at gmail.com> wrote:
> I double checked the old "create extension" command in our script and it did
> specify the db name correctly here's the command (this is via a windows
> batch file, DB_NAME is the db being created):
>
> .\bin\psql.exe -d %DB_NAME% -U %POSTGRESQL_SUPER_USER% -c "CREATE EXTENSION
> postgis"

Mind you, you can use a few environment variables[1] in the batch file, e.g.:

set PATH=C:\Program Files\PostgreSQL\9.3\bin;%PATH
set PGDATABASE=%DB_NAME%
set PGUSER=%POSTGRESQL_SUPER_USER%

psql -c "CREATE EXTENSION postgis"
psql -f someotherfile.sql


This is particularly handy if you have several multiple libpq-related
commands from a batch script.
-Mike

[1] http://www.postgresql.org/docs/current/static/libpq-envars.html


More information about the postgis-users mailing list