Re: Superuser accout (PostgreSQL 9.0.4)

From: Grzegorz Szpetkowski <gszpetkowski(at)gmail(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Superuser accout (PostgreSQL 9.0.4)
Date: 2011-04-08 13:38:07
Message-ID: BANLkTikacQbjX2V4BT5ivQzAezuFDn66Jw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks. I didn't know about single-user mode:

"The primary use for this mode is during bootstrapping by initdb.
Sometimes it is used for debugging or disaster recovery (but note that
running a single-user server is not truly suitable for debugging the
server, since no realistic interprocess communication and locking will
happen). When invoked in single-user mode from the shell, the user can
enter queries and the results will be printed to the screen, but in a
form that is more useful for developers than end users. In the
single-user mode, the session user will be set to the user with ID 1,
and implicit superuser powers are granted to this user. This user does
not actually have to exist, so the single-user mode can be used to
manually recover from certain kinds of accidental damage to the system
catalogs."

I made:

/usr/lib/postgresql/9.0/bin/postgres --single -D /etc/postgresql/9.0/main/
backend> ALTER ROLE postgres SUPERUSER

Then Ctrl-D (EOF) and it works fine.

BTW (PostgreSQL 9.0.4): It's just my mistake, I have latest 9.0.3 version.

Regards,
Grzegorz Sz.

2011/4/8 Josh Kupershmidt <schmiddy(at)gmail(dot)com>:
> On Thu, Apr 7, 2011 at 11:15 PM, Grzegorz Szpetkowski
> <gszpetkowski(at)gmail(dot)com> wrote:
>> Is there any way to restore superuser without recreating cluster from
>> scratch (initdb, pg_createcluster etc.) ? Or better should PostgreSQL
>> prevent for such situation (mistake command) ? I don't know is there
>> any "at least one superuser per cluster rule" (?)
>
> I think you should be able to start Postgres in single-user mode, see:
> <http://www.postgresql.org/docs/9.0/static/app-postgres.html>
> and from there you can fix your superuser privileges.
>
> Josh
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Grzegorz Szpetkowski 2011-04-08 14:11:01 Re: Valid role name (PostgreSQL 9.0.4)
Previous Message Josh Kupershmidt 2011-04-08 13:02:37 Re: What does \timing measure?