wrong message on REASSIGN OWNED

Started by Jaime Casanovaover 14 years ago12 messages
#1Jaime Casanova
jaime@2ndquadrant.com

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

#2Robert Haas
robertmhaas@gmail.com
In reply to: Jaime Casanova (#1)
Re: wrong message on REASSIGN OWNED

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

#3Jaime Casanova
jaime@2ndquadrant.com
In reply to: Robert Haas (#2)
Re: wrong message on REASSIGN OWNED

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

#4Robert Haas
robertmhaas@gmail.com
In reply to: Jaime Casanova (#3)
Re: wrong message on REASSIGN OWNED

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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Robert Haas (#4)
Re: wrong message on REASSIGN OWNED

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

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jaime Casanova (#3)
Re: wrong message on REASSIGN OWNED

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

#7Robert Haas
robertmhaas@gmail.com
In reply to: Tom Lane (#5)
Re: wrong message on REASSIGN OWNED

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

#8Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#5)
Re: wrong message on REASSIGN OWNED

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

#9Jaime Casanova
jaime@2ndquadrant.com
In reply to: Tom Lane (#5)
Re: wrong message on REASSIGN OWNED

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

#10Alvaro Herrera
alvherre@commandprompt.com
In reply to: Robert Haas (#2)
Re: wrong message on REASSIGN OWNED

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

#11Jaime Casanova
jaime@2ndquadrant.com
In reply to: Alvaro Herrera (#10)
Re: wrong message on REASSIGN OWNED

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

#12Alvaro Herrera
alvherre@commandprompt.com
In reply to: Tom Lane (#6)
Re: wrong message on REASSIGN OWNED

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