Re: inconsistent owners in newly created databases?

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Greg Stark <gsstark(at)MIT(dot)EDU>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: inconsistent owners in newly created databases?
Date: 2004-05-05 16:33:40
Message-ID: 87zn8mvnob.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:

> I agree with the advantage.
>
> But I'm uneasy to know what a special owner would be, pratically speaking.
> If it would mean that everywhere in the source code where an owner is
> manipulated, there must be some kind of special test for that case, I'm
> not sure it would be that great...

Well I can't think of anywhere else in the code that would need this special
case other than creating a database. My thinking is it would otherwise act as
a special user except when you're copying a database it would get mean "set
the owner of this object to the owner of the new database".

> Also any database can be used as a template, not just template1.
> Moreover, template1 is a still usable database, that can be set with
> whatever you want in new created, so it is not "that" special...

Well perhaps it should be an option on create database?

create database foo with template=template1 owner=bar templateowner=baz

Or perhaps it should just default to the name of the template database maybe
the owner of the template database. So these objects would be owned by user
"template1" in the template1 database.

Then If I create a database with

create database user2 with template=user1 owner=user2

then any objects owned by user1 in the template become owned by user2 in the
new database.

Using the owner of the template database has the advantage that you can copy a
copy of a database and get the same result as if you copied the original. Eg,
this would work:

create database template2 with template=template1 owner=template2
create database template3 with template=template2 owner=template3

and the result would be the same as

create database template3 with template=template1 owner=template3

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message sdv mailer 2004-05-05 16:35:10 Re: PostgreSQL pre-fork speedup
Previous Message sdv mailer 2004-05-05 16:30:30 Re: PostgreSQL pre-fork speedup