Thread: owner orphaned databases

owner orphaned databases

From
CSN
Date:
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

Re: owner orphaned databases

From
CSN
Date:
Hmm, for some reason the "deleted" user does in fact
exist but isn't getting added in the "CREATE USER"
section of the dumpall file. It has a user id of "1"
if that makes any difference.

CSN


--- CSN wrote:

> 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!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

Re: owner orphaned databases

From
Tom Lane
Date:
CSN <cool_screen_name90001@yahoo.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