Re: Commands to change name, schema, owner

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Commands to change name, schema, owner
Date: 2003-06-21 15:27:49
Message-ID: 25860.1056209269@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Right, there's a global variable that stores the database name, but that
> will have to disappear. You'll have to look it up in the catalog like
> everything else.

That answer is okay as long as we don't need to get at the value while
outside any transaction (or in a failed transaction). Offhand I can't
think of a reason we'd need to, but you'll need to look closely at the
uses of that variable.

[ other answers look fine ]

> For those objects who don't live within schemas, you only need to own the
> object or the containing table, respectively. No privilege on any schema
> is required. In detail:

> constraint -> owner of table
> database -> owner of database
> rule -> owner of table
> schema -> owner of schema
> trigger -> owner of table

It could be argued that renaming a database should require CREATEDB
rights, and that renaming a schema should require create-schema rights
at the database level. For example, if user joe is given a schema joe,
which he proceeds to rename to bob, it's not a lot different from him
having been able to make a schema bob in the first place. ISTM if the
DBA had disallowed create-schema rights to joe, he'd see this as an
end run around that prohibition.

The constraint/rule/trigger cases look fine, since names of those
entities aren't super interesting anyway.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kurt Roeckx 2003-06-21 15:33:37 Regression tests fails to start on system without unix sockets.
Previous Message Joe Conway 2003-06-21 15:25:57 Re: compile failure on cvs tip --with-krb5