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?)