pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16025: pg_default tablespace is removable but not creatable
2+ messages / 2 participants
[nested] [flat]

* BUG #16025: pg_default tablespace is removable but not creatable
@ 2019-09-25 23:31  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2019-09-25 23:31 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: kingsbury.matthew@gmail.com

The following bug has been logged on the website:

Bug reference:      16025
Logged by:          Matthew Kingsbury
Email address:      kingsbury.matthew@gmail.com
PostgreSQL version: 11.5
Operating system:   Ubuntu 18.04 LTS
Description:        

I was able to rename pg_default to something else, accidentally. However,
there appears to be no mechanism to replace pg_default nor can one replace
the pg_default after performing this action. E.g. if one runs the command:

ALTER TABLESPACE pg_default
  RENAME TO not_pg_default;

ALTER TABLESPACE not_pg_default
  RENAME TO pg_default;

One encounters this error:
ERROR: unacceptable tablespace name "pg_default"
DETAIL: The prefix "pg_" is reserved for system tablespaces.

Leaving one without the pg_default tablespace.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #16025: pg_default tablespace is removable but not creatable
@ 2019-09-26 00:09  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-09-26 00:09 UTC (permalink / raw)
  To: kingsbury.matthew@gmail.com; +Cc: pgsql-bugs@lists.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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-09-26 00:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25 23:31 BUG #16025: pg_default tablespace is removable but not creatable PG Bug reporting form <noreply@postgresql.org>
2019-09-26 00:09 ` Tom Lane <tgl@sss.pgh.pa.us>

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