3

I can't create postgis extension in single-user mode in postgres. But I can do that from pgadmin.

Is creating extension in single-user mode even possible? Can find any docs on that.

Full info on my question can be seen there.

5
  • Do you mean from a psql prompt. Have you checked that you have correct permissions, see the extension docs, which state you typically need superuser or db owner permissions. It is possible you are using psql and pgAdmin with different users? Commented Jan 27, 2015 at 10:02
  • Read about single user mode Commented Jan 27, 2015 at 10:03
  • I know what single user mode is, but who said you can't use psql to connect to a db in single-user mode. Commented Jan 27, 2015 at 10:07
  • You don't need single-user mode. It is only needed for creating the catalogs during bootstrapping. The postgis-extension can be added using normal operations. Commented Jan 27, 2015 at 10:36
  • Oh really? Enlighten me how to do that with docker when building the image, so that right after the build users would have completely working geospatial database please =) AFAIK there is no solution. Commented Jan 27, 2015 at 10:39

1 Answer 1

0

Anyway, right now I have a comment on the PostgreSQL mailing list.

Why in the world would you think that's a good thing to do?

Single-user mode is a barely-documented disaster recovery aid. It's not meant for routine activity. There are a whole lot of behaviors you want that are turned off in single-user mode.

The specific reason why this doesn't work is this bit in heap_create_with_catalog:

/*
 * Decide whether to create an array type over the relation's rowtype. We
 * do not create any array types for system catalogs (ie, those made
 * during initdb). We do not create them where the use of a relation as
 * such is an implementation detail: toast tables, sequences and indexes.
 */
if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||
                          relkind == RELKIND_VIEW ||
                          relkind == RELKIND_MATVIEW ||
                          relkind == RELKIND_FOREIGN_TABLE ||
                          relkind == RELKIND_COMPOSITE_TYPE))
    new_array_oid = AssignTypeArrayOid();

We could possibly develop some other mechanism for detecting whether we're within the initdb sequence, but I can't get very excited about treating this as a bug. Single-user mode hasn't been considered a standard user environment since maybe the early 90s.

Sign up to request clarification or add additional context in comments.

1 Comment

It's interesting to note that single user mode is 'highly recommended' for initialisation tasks in the official Docker Postgres image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.