From: Tom Lane <tgl@sss.pgh.pa.us>
To: kingsbury.matthew@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16025: pg_default tablespace is removable but not creatable
Date: Wed, 25 Sep 2019 20:09:21 -0400
Message-ID: <2414.1569456561@sss.pgh.pa.us> (raw)
In-Reply-To: <16025-c86354bc1ad3e898@postgresql.org>
References: <16025-c86354bc1ad3e898@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> I was able to rename pg_default to something else, accidentally.
If you're superuser, yeah. Don't do that.
> However,
> there appears to be no mechanism to replace pg_default nor can one replace
> the pg_default after performing this action.
[ shrug... ] There are innumerable unrecoverable things you can do
as superuser. "DELETE FROM pg_database" is a fun example (*don't*
try this at work). This isn't a bug, any more than it's a bug that
root can destroy the whole filesystem. Cautious DBAs don't do more
than they absolutely must as superuser. We've made efforts lately
to reduce the number of tasks that require superuser as opposed to
some more-restricted role, eg you can do a lot from a role with
CREATEUSER privilege.
FWIW, you can in fact get out of the described situation:
regression=# ALTER TABLESPACE pg_default RENAME TO not_pg_default;
ALTER TABLESPACE
regression=# table pg_tablespace;
oid | spcname | spcowner | spcacl | spcoptions
------+----------------+----------+--------+------------
1664 | pg_global | 10 | |
1663 | not_pg_default | 10 | |
(2 rows)
regression=# update pg_tablespace set spcname = 'pg_default' where spcname = 'not_pg_default';
UPDATE 1
regression=# table pg_tablespace;
oid | spcname | spcowner | spcacl | spcoptions
------+------------+----------+--------+------------
1664 | pg_global | 10 | |
1663 | pg_default | 10 | |
(2 rows)
Nonetheless, the bottom line is that PG superusers do not have
training wheels.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, kingsbury.matthew@gmail.com
Subject: Re: BUG #16025: pg_default tablespace is removable but not creatable
In-Reply-To: <2414.1569456561@sss.pgh.pa.us>
References: <16025-c86354bc1ad3e898@postgresql.org> <2414.1569456561@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox