Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-06 Thread Fabien COELHO
Dear Greg, I agree with the advantage. But I'm uneasy to know what a special owner would be, pratically speaking. Well I can't think of anywhere else in the code that would need this special case other than creating a database. I disagree, there are consequences. That could be

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-06 Thread Greg Stark
Fabien COELHO [EMAIL PROTECTED] 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

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-06 Thread Fabien COELHO
nspacl = aclitems_switch_grantor(nspacl, datdba) Instead of having a hard coded list of template1 objects that need to be chowned to the database owner. Perhaps there should be a special user like dbowner which owns the schema and whatever other objects are necessary. [...] I

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-05 Thread Greg Stark
Fabien COELHO [EMAIL PROTECTED] writes: nspacl = aclitems_switch_grantor(nspacl, datdba) Instead of having a hard coded list of template1 objects that need to be chowned to the database owner. Perhaps there should be a special user like dbowner which owns the schema and whatever other

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-04 Thread Fabien COELHO
Dear Tom, However, I feel that the owner should own the public schema and maybe some other stuff to be carefully selected, without bluring that important distinction? From a definitional standpoint I don't have a problem with that. Good. From an implementation standpoint, I fear it

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-04 Thread Tom Lane
Fabien COELHO [EMAIL PROTECTED] writes: Another heavier but more general approach would be to add a boolean to pg_database to tell whether the first connection housekeeping was performed, I was envisioning a bool column added to pg_database, and having the set of operations just hard-coded

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-04 Thread Fabien COELHO
Dear Tom, Another heavier but more general approach would be to add a boolean to pg_database to tell whether the first connection housekeeping was performed, I was envisioning a bool column added to pg_database, and having the set of operations just hard-coded into the backend. Why

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-04 Thread Tom Lane
Fabien COELHO [EMAIL PROTECTED] writes: I was thinking about something fuzzy enough as: UPDATE pg_catalog.pg_namespace SET nspowner=datdba, nspacl=NULL -- NULL means default rights... The later is simple and makes sense anyway for a newly created database. No, I don't think it does. The

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-04 Thread Fabien COELHO
Dear Tom, UPDATE pg_catalog.pg_namespace SET nspowner=datdba, nspacl=NULL -- NULL means default rights... The later is simple and makes sense anyway for a newly created database. No, I don't think it does. The DBA presently can set up a site-wide policy about use of public by altering

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-03 Thread Thomas Swan
Fabien COELHO wrote: Dear hackers, It seems to me that the current default setup for a new database which is given to some user is not consistent (createdb -O calvin foo or CREATE DATABASE foo WITH OWNER calvin). Indeed, although the database belongs to the owner, the public schema still

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-03 Thread Thomas Swan
Fabien COELHO wrote: Dear Thomas, * create the database with the new owner specified. -- As a superuser in the newly created database update pg_am set amowner = {userid} update pg_class set relowner = {userid} You don't want to update ownership of tables in system schemas. AFAICS, any

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-03 Thread Tom Lane
Thomas Swan [EMAIL PROTECTED] writes: Fabien COELHO wrote: You don't want to update ownership of tables in system schemas. AFAICS, any changes they make are localized to their database not the whole database system. A database owner who is not a superuser should *not* be able to fool with

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-03 Thread Thomas Swan
Tom Lane wrote: Thomas Swan [EMAIL PROTECTED] writes: Fabien COELHO wrote: You don't want to update ownership of tables in system schemas. AFAICS, any changes they make are localized to their database not the whole database system. A database owner who is not a superuser

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-03 Thread Fabien COELHO
A database owner who is not a superuser should *not* be able to fool with the built-in catalog entries. Database owner != superuser, and I don't want us blurring the distinction... Yes sure. I agree, especially if the owner is one of my students;-) However, I feel that the owner should own

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-03 Thread Fabien COELHO
... Without this the db owner cannot drop types that may have been copied from the template. Hmmm. I'm concerned about security, such as enabling the owner to load new trusted code. You may be right, but I'm afraid it is delicate to decide what owner fields should be changed. Owning a

Re: [HACKERS] inconsistent owners in newly created databases?

2004-05-03 Thread Tom Lane
Fabien COELHO [EMAIL PROTECTED] writes: However, I feel that the owner should own the public schema and maybe some other stuff to be carefully selected, without bluring that important distinction? From a definitional standpoint I don't have a problem with that. From an implementation

[HACKERS] inconsistent owners in newly created databases?

2004-04-30 Thread Fabien COELHO
Dear hackers, It seems to me that the current default setup for a new database which is given to some user is not consistent (createdb -O calvin foo or CREATE DATABASE foo WITH OWNER calvin). Indeed, although the database belongs to the owner, the public schema still belongs to the database