Cannot create role, no default superuser role exists - Mailing list pgsql-general

From Robert McAlpine
Subject Cannot create role, no default superuser role exists
Date
Msg-id CACisWYEYWS0Ndn4c6nHqKfxBz1xBcYYwdwDgvY6G4HDW4nN0dA@mail.gmail.com
Whole thread Raw
Responses Re: Cannot create role, no default superuser role exists  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general

Postgresql 9.5, Ubuntu 14.04.

I broke my ability to access postgres after attemping to install postgres-xc (ironic, since I installed that to use pg_ctl to reload my pg_hba.conf without restarting the entirety of postgres).

After doing so I can no longer access my databases via psql or any other utilities, getting the error:

FATAL:  role "postgres" does not exist

Unfortunately the same error gets thrown if I attempt to use 'createuser'.

The postgres user and role were the only ones able to access postgresql server, so altering the permissions in my pg_hba.conf also got me nowhere.

I made a complete copy of the data directory, took a snapshot (it is on a vm), then purged postgresql-9.5 and reinstalled, restoring to a dump that is a few days old. I thought about copying all the files from the data directory (except for the roles table file) into a fresh install with a correct default postgres role, but my gut tells me that screwing around with those files is doomed to fail.

I would appreciate any help or thoughts on how to recover access to the data.
--
Robert McAlpine

pgsql-general by date:

Previous
From:
Date:
Subject: Re: How to find configuration data in _PG_init()
Next
From: Adrian Klaver
Date:
Subject: Re: Cannot create role, no default superuser role exists