Обсуждение: wrong message on REASSIGN OWNED
Hi, on shdepReassignOwned() we have this message, which is obviously wrong we are not dropping objects just reassigning them... """ ereport(ERROR, (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), errmsg("cannot drop objects owned by %s because they are " "required by the database system", getObjectDescription(&obj)))); """ but haven't thought of a good way of rephrase it -- Jaime Casanova www.2ndQuadrant.com Professional PostgreSQL: Soporte 24x7 y capacitación
On Thu, Jun 9, 2011 at 1:26 PM, Jaime Casanova <jaime@2ndquadrant.com> wrote: > on shdepReassignOwned() we have this message, which is obviously wrong > we are not dropping objects just reassigning them... > """ > ereport(ERROR, > > (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), > errmsg("cannot drop objects owned > by %s because they are " > "required by the > database system", > getObjectDescription(&obj)))); > """ > > but haven't thought of a good way of rephrase it "can't reassign objects owned by %s because this user is internal to the database system" ? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
On Sat, Jun 11, 2011 at 8:01 PM, Robert Haas <robertmhaas@gmail.com> wrote: > > "can't reassign objects owned by %s because this user is internal to > the database system" ? > that message is not that clear... it seems to imply i can't reassign any object from that user... btw, i'm allowed to use ALTER TABLE to assign a new owner (even an unprivileged one) to a system catalog, probably that's a bug. db=# create role unprivileged_user login; CREATE ROLE db=# alter table pg_class owner to unprivileged_user ; ALTER TABLE db=# \dt pg_class List of relations Schema | Name | Type | Owner ------------+----------+-------+-------------------pg_catalog | pg_class | table | unprivileged_user (1 row) -- Jaime Casanova www.2ndQuadrant.com Professional PostgreSQL: Soporte 24x7 y capacitación
On Mon, Jun 13, 2011 at 2:41 AM, Jaime Casanova <jaime@2ndquadrant.com> wrote: > On Sat, Jun 11, 2011 at 8:01 PM, Robert Haas <robertmhaas@gmail.com> wrote: >> >> "can't reassign objects owned by %s because this user is internal to >> the database system" ? >> > > that message is not that clear... it seems to imply i can't reassign > any object from that user... cannot change owner of some objects owned by %s because they are required by the database system? > btw, i'm allowed to use ALTER TABLE to assign a new owner (even an > unprivileged one) to a system catalog, probably that's a bug. +1 for tightening that up in 9.2. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Robert Haas <robertmhaas@gmail.com> writes: > On Mon, Jun 13, 2011 at 2:41 AM, Jaime Casanova <jaime@2ndquadrant.com> wrote: >> btw, i'm allowed to use ALTER TABLE to assign a new owner (even an >> unprivileged one) to a system catalog, probably that's a bug. > +1 for tightening that up in 9.2. Nonsense. You won't like the results of "DELETE FROM pg_proc;" either, but we don't try to put training wheels on superusers. regards, tom lane
Jaime Casanova <jaime@2ndquadrant.com> writes: > On Sat, Jun 11, 2011 at 8:01 PM, Robert Haas <robertmhaas@gmail.com> wrote: >> "can't reassign objects owned by %s because this user is internal to >> the database system" ? > that message is not that clear... it seems to imply i can't reassign > any object from that user... I think s/drop/reassign ownership of/ is sufficient. There's no reason to change the rest of the message, especially because the same phraseology is in use elsewhere. regards, tom lane
On Mon, Jun 13, 2011 at 9:55 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Robert Haas <robertmhaas@gmail.com> writes: >> On Mon, Jun 13, 2011 at 2:41 AM, Jaime Casanova <jaime@2ndquadrant.com> wrote: >>> btw, i'm allowed to use ALTER TABLE to assign a new owner (even an >>> unprivileged one) to a system catalog, probably that's a bug. > >> +1 for tightening that up in 9.2. > > Nonsense. You won't like the results of "DELETE FROM pg_proc;" either, > but we don't try to put training wheels on superusers. allow_system_table_mods? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
On 06/13/2011 09:55 AM, Tom Lane wrote: > Robert Haas<robertmhaas@gmail.com> writes: >> On Mon, Jun 13, 2011 at 2:41 AM, Jaime Casanova<jaime@2ndquadrant.com> wrote: >>> btw, i'm allowed to use ALTER TABLE to assign a new owner (even an >>> unprivileged one) to a system catalog, probably that's a bug. >> +1 for tightening that up in 9.2. > Nonsense. You won't like the results of "DELETE FROM pg_proc;" either, > but we don't try to put training wheels on superusers. Yeah. Amusing anecdote along these lines: I had fun recently recovering the situation for someone who had for reasons I can't even imagine done "delete from pg_database;" on their production system. cheers andrew
On Mon, Jun 13, 2011 at 8:55 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Robert Haas <robertmhaas@gmail.com> writes: >> On Mon, Jun 13, 2011 at 2:41 AM, Jaime Casanova <jaime@2ndquadrant.com> wrote: >>> btw, i'm allowed to use ALTER TABLE to assign a new owner (even an >>> unprivileged one) to a system catalog, probably that's a bug. > >> +1 for tightening that up in 9.2. > > Nonsense. You won't like the results of "DELETE FROM pg_proc;" either, > but we don't try to put training wheels on superusers. > really? i thought we do when system catalogs are involved based on this example: """ db=# alter table pg_largeobject set tablespace tblspc_prueba; ERROR: permission denied: "pg_largeobject" is a system catalog """ -- Jaime Casanova www.2ndQuadrant.com Professional PostgreSQL: Soporte 24x7 y capacitación
Excerpts from Robert Haas's message of sáb jun 11 21:01:55 -0400 2011: > On Thu, Jun 9, 2011 at 1:26 PM, Jaime Casanova <jaime@2ndquadrant.com> wrote: > > on shdepReassignOwned() we have this message, which is obviously wrong > > we are not dropping objects just reassigning them... > > """ > > ereport(ERROR, > > > > (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), > > errmsg("cannot drop objects owned > > by %s because they are " > > "required by the > > database system", > > getObjectDescription(&obj)))); > > """ Oh my. I introduced this mistake 6 years ago and nobody noticed in all this time. I guess this is not a very frequently used feature. > > but haven't thought of a good way of rephrase it > > "can't reassign objects owned by %s because this user is internal to > the database system" ? Thanks, I'll use that. -- Álvaro Herrera <alvherre@commandprompt.com> The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support
On Mon, Jun 13, 2011 at 10:37 AM, Alvaro Herrera <alvherre@commandprompt.com> wrote: > Excerpts from Robert Haas's message of sáb jun 11 21:01:55 -0400 2011: >> On Thu, Jun 9, 2011 at 1:26 PM, Jaime Casanova <jaime@2ndquadrant.com> wrote: >> > on shdepReassignOwned() we have this message, which is obviously wrong >> > we are not dropping objects just reassigning them... >> > """ >> > ereport(ERROR, >> > >> > (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), >> > errmsg("cannot drop objects owned >> > by %s because they are " >> > "required by the >> > database system", >> > getObjectDescription(&obj)))); >> > """ > > Oh my. I introduced this mistake 6 years ago and nobody noticed in all > this time. I guess this is not a very frequently used feature. > well, i used it once last year... ;) but the only reason i found this one was because i was giving a training and it jumps out in the middle of it... -- Jaime Casanova www.2ndQuadrant.com Professional PostgreSQL: Soporte 24x7 y capacitación
Excerpts from Tom Lane's message of lun jun 13 09:57:50 -0400 2011: > Jaime Casanova <jaime@2ndquadrant.com> writes: > > On Sat, Jun 11, 2011 at 8:01 PM, Robert Haas <robertmhaas@gmail.com> wrote: > >> "can't reassign objects owned by %s because this user is internal to > >> the database system" ? > > > that message is not that clear... it seems to imply i can't reassign > > any object from that user... > > I think s/drop/reassign ownership of/ is sufficient. There's no reason > to change the rest of the message, especially because the same > phraseology is in use elsewhere. Fixed in 8.2 and up. -- Álvaro Herrera <alvherre@commandprompt.com> The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support