1

Update: Reposted this question on StackExchange / Database Administrators: https://dba.stackexchange.com/q/152496/57043

I'm using PostgreSQL 9.2.15 with PostGIS 2.0.7 through the standard packages available on CentOS 7 with EPEL.

I have a server script to automatically setup a PostGIS database, by first executing initdb, then using postgres --single to create a new database with PostGIS extension. This works roughly like this:

initdb -D ...

postgres --single -D ... postgres <<'EOF'
    CREATE DATABASE mydb;
EOF

postgres --single -D ... mydb <<'EOF'
    CREATE EXTENSION postgis;
EOF

However, the last command produces the following strange error message:

ERROR:  type reclassarg[] does not exist
STATEMENT:  CREATE EXTENSION postgis;

If I instead run the database server and execute CREATE EXTENSION postgis via sql, everything works fine:

postgres -D ... &

# Wait until service it up and running

psql mydb <<'EOF'
    CREATE EXTENSION postgis;
EOF

But that is not suitable for a database initialization script.

So how can I initialize a PostGIS database in PostgreSQL single-user mode?

(Also, is this question appropriate here, or should it go to another StackExchange community?)

closed as off-topic by Vince, Fezter Oct 17 '16 at 10:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Hi vog, postgres/postgis questions do seem to be accepted here, but there is a chance you might get more of the relevant expertise on dba.stack. – Matt Oct 17 '16 at 8:33
  • GIS-centric PostGIS questions are appropriate here in GIS SE. This is a PostgreSQL configuration question that happens to involve PostGIS. – Vince Oct 17 '16 at 11:38
  • Questions that are cross-posts should be deleted. Closing isn't enough. – Evan Carroll Jan 10 '17 at 20:19