Re: owner orphaned databases

Lists: pgsql-general
From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: owner orphaned databases
Date: 2004-08-27 01:49:08
Message-ID: 20040827014908.25962.qmail@web52909.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Not a big deal, but I'm transferring a dumpall and
it's choking on databases where the owner no longer
exists. Maybe it shouldn't be possible to delete a
user while it still owns databases, or maybe a cascade
option, or requiring changing the ownership to another
user?

CREATE DATABASE "orphan" WITH OWNER = "deleted" ...;
...
SET SESSION AUTHORIZATION "deleted";
...
\c orphan # fails because "orphan" wasn't created

CSN

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: CSN <cool_screen_name90001(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: owner orphaned databases
Date: 2004-08-27 05:00:21
Message-ID: 6435.1093582821@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

CSN <cool_screen_name90001(at)yahoo(dot)com> writes:
> Maybe it shouldn't be possible to delete a
> user while it still owns databases,

You mean like this?

regression=# create user foo;
CREATE USER
regression=# create database foo owner foo;
CREATE DATABASE
regression=# drop user foo;
ERROR: user "foo" cannot be dropped
DETAIL: The user owns database "foo".
regression=#

There are plenty of related scenarios that we don't cover, but AFAIR
that particular interlock has always been there.

regards, tom lane