pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
17+ messages / 6 participants
[nested] [flat]
* BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
@ 2012-12-09 14:12 spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 17+ messages in thread
From: spam_eater@gmx.net @ 2012-12-09 14:12 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 7748
Logged by: Thomas Kellerer
Email address: spam_eater@gmx.net
PostgreSQL version: 9.2.2
Operating system: Windows XP, 32bit
Description:
Using "drop owned by someuser" in 9.2.2 fails with the error
"unrecognized object class: 1262"
This is what happens on the commandline. The PostgreSQL cluster was
initialized right before running these steps using the command:
initdb -D pgdata --lc-messages=English -U postgres -E UTF8 -A md5
This is what happens when using "drop owned by":
c:\etc\postgres-9.2>psql
psql (9.2.2)
Type "help" for help.
postgres=# create user testuser with password 'secret';
CREATE ROLE
postgres=# create database testdb owner testuser;
CREATE DATABASE
postgres=# \q
c:\etc\postgres-9.2>psql -U testuser testdb
psql (9.2.2)
Type "help" for help.
testdb=> create table foobar (id integer);
CREATE TABLE
testdb=> drop owned by testuser;
ERROR: unrecognized object class: 1262
postgres=# select version();
version
-------------------------------------------------------------
PostgreSQL 9.2.2, compiled by Visual C++ build 1600, 32-bit
(1 row)
Dropping the objects manually works without problems.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
@ 2012-12-09 16:43 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-12-09 17:04 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Thomas Kellerer <spam_eater@gmx.net>
2012-12-09 22:44 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Thomas Kellerer <spam_eater@gmx.net>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 3 replies; 17+ messages in thread
From: Tom Lane @ 2012-12-09 16:43 UTC (permalink / raw)
To: spam_eater@gmx.net; +Cc: pgsql-bugs; Alvaro Herrera <alvherre@commandprompt.com>
spam_eater@gmx.net writes:
> postgres=# create user testuser with password 'secret';
> CREATE ROLE
> postgres=# create database testdb owner testuser;
> CREATE DATABASE
> testdb=> drop owned by testuser;
> ERROR: unrecognized object class: 1262
I can reproduce this in all versions back to 8.3. In 8.2, the role's
ownership of the database is silently ignored, which I think was the
design intention. I doubt that we want DROP OWNED dropping whole
databases. At most maybe we should raise a NOTICE?
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-12-09 17:04 ` Thomas Kellerer <spam_eater@gmx.net>
2 siblings, 0 replies; 17+ messages in thread
From: Thomas Kellerer @ 2012-12-09 17:04 UTC (permalink / raw)
To: pgsql-bugs
Tom Lane wrote on 09.12.2012 17:43:
> spam_eater@gmx.net writes:
>> postgres=# create user testuser with password 'secret';
>> CREATE ROLE
>> postgres=# create database testdb owner testuser;
>> CREATE DATABASE
>> testdb=> drop owned by testuser;
>> ERROR: unrecognized object class: 1262
>
> I can reproduce this in all versions back to 8.3. In 8.2, the role's
> ownership of the database is silently ignored, which I think was the
> design intention. I doubt that we want DROP OWNED dropping whole
> databases. At most maybe we should raise a NOTICE?
>
I don't want to drop the database, just all objects that are created by that user (tables, schemas, ...)
(In my example I first create a table)
And this has definitely worked before, otherwise my unit tests would have failed all the time.
Regards
Thomas
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-12-09 22:44 ` Thomas Kellerer <spam_eater@gmx.net>
2 siblings, 0 replies; 17+ messages in thread
From: Thomas Kellerer @ 2012-12-09 22:44 UTC (permalink / raw)
To: pgsql-bugs
Tom Lane wrote on 09.12.2012 17:43:
> spam_eater@gmx.net writes:
>> postgres=# create user testuser with password 'secret';
>> CREATE ROLE
>> postgres=# create database testdb owner testuser;
>> CREATE DATABASE
>> testdb=> drop owned by testuser;
>> ERROR: unrecognized object class: 1262
>
> I can reproduce this in all versions back to 8.3. In 8.2, the role's
> ownership of the database is silently ignored, which I think was the
> design intention. I doubt that we want DROP OWNED dropping whole
> databases. At most maybe we should raise a NOTICE?
>
Just for clarification, this is how it worked in 9.1 (and I'm pretty sure in 9.2.1 as well):
First I create a testuser and the database:
C:\>psql -X -U postgres postgres
psql (9.1.3)
postgres=# create database testdb owner testuser;
ERROR: role "testuser" does not exist
postgres=# create user testuser with password 'secret';
CREATE ROLE
postgres=# create database testdb owner testuser;
CREATE DATABASE
postgres=# \q
Then I log in as the testuser, create a table and drop all objects again:
C:\>psql -X -U testuser testdb
Password for user testuser:
psql (9.1.3)
testdb=> create table foobar (id integer);
CREATE TABLE
testdb=> drop owned by testuser;
DROP OWNED
testdb=>
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-12-10 04:13 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2012-12-10 04:28 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jaime Casanova <jaime@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
2 siblings, 2 replies; 17+ messages in thread
From: Alvaro Herrera @ 2012-12-10 04:13 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: spam_eater@gmx.net; pgsql-bugs
Tom Lane wrote:
>
> spam_eater@gmx.net writes:
> > postgres=# create user testuser with password 'secret';
> > CREATE ROLE
> > postgres=# create database testdb owner testuser;
> > CREATE DATABASE
> > testdb=> drop owned by testuser;
> > ERROR: unrecognized object class: 1262
>
> I can reproduce this in all versions back to 8.3. In 8.2, the role's
> ownership of the database is silently ignored, which I think was the
> design intention. I doubt that we want DROP OWNED dropping whole
> databases. At most maybe we should raise a NOTICE?
I broke it recently: fe3b5eb08
Got a one day old guy at home, can't look at this for at least a
week, sorry.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2012-12-10 04:28 ` Jaime Casanova <jaime@2ndquadrant.com>
2012-12-11 19:04 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
1 sibling, 1 reply; 17+ messages in thread
From: Jaime Casanova @ 2012-12-10 04:28 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; spam_eater@gmx.net; pgsql-bugs
On Sun, Dec 9, 2012 at 11:13 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> Tom Lane wrote:
>>
>> spam_eater@gmx.net writes:
>> > postgres=# create user testuser with password 'secret';
>> > CREATE ROLE
>> > postgres=# create database testdb owner testuser;
>> > CREATE DATABASE
>> > testdb=> drop owned by testuser;
>> > ERROR: unrecognized object class: 1262
>>
>> I can reproduce this in all versions back to 8.3. In 8.2, the role's
>> ownership of the database is silently ignored, which I think was the
>> design intention. I doubt that we want DROP OWNED dropping whole
>> databases. At most maybe we should raise a NOTICE?
>
> I broke it recently: fe3b5eb08
>
whatever is the right way to solve this... shouldn't we do something
similar in shdepReassignOwned() in which we are still ignoring shared
objects?
--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
Phone: +593 4 5107566 Cell: +593 987171157
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2012-12-10 04:28 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jaime Casanova <jaime@2ndquadrant.com>
@ 2012-12-11 19:04 ` Jeff Janes <jeff.janes@gmail.com>
2012-12-11 20:51 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jaime Casanova <jaime@2ndquadrant.com>
0 siblings, 1 reply; 17+ messages in thread
From: Jeff Janes @ 2012-12-11 19:04 UTC (permalink / raw)
To: Jaime Casanova <jaime@2ndquadrant.com>; +Cc: Alvaro Herrera <alvherre@2ndquadrant.com>; Tom Lane <tgl@sss.pgh.pa.us>; spam_eater@gmx.net; pgsql-bugs
On Sun, Dec 9, 2012 at 8:28 PM, Jaime Casanova <jaime@2ndquadrant.com> wrote:
> On Sun, Dec 9, 2012 at 11:13 PM, Alvaro Herrera
> <alvherre@2ndquadrant.com> wrote:
>> Tom Lane wrote:
>>>
>>> spam_eater@gmx.net writes:
>>> > postgres=# create user testuser with password 'secret';
>>> > CREATE ROLE
>>> > postgres=# create database testdb owner testuser;
>>> > CREATE DATABASE
>>> > testdb=> drop owned by testuser;
>>> > ERROR: unrecognized object class: 1262
>>>
>>> I can reproduce this in all versions back to 8.3. In 8.2, the role's
>>> ownership of the database is silently ignored, which I think was the
>>> design intention. I doubt that we want DROP OWNED dropping whole
>>> databases. At most maybe we should raise a NOTICE?
>>
>> I broke it recently: fe3b5eb08
>>
>
> whatever is the right way to solve this... shouldn't we do something
> similar in shdepReassignOwned() in which we are still ignoring shared
> objects?
Based on the commit message, it seems like it should *only* be in
shdepReassignOwned.
However, when I put it there it fails, as the code that does the
ownership change cannot deal with tablespaces (or databases)
ERROR: unexpected classid 1213
I am unsure of the goal here. The docs clearly say that only objects
in the current database are affected, so why are we even trying to do
something with tablespaces (or databases), which do not live in any
database? And if we want to change the contract to allow it to climb
out of the current database, why limit it to shared objects rather
than crawling all databases?
Cheers,
Jeff
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2012-12-10 04:28 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jaime Casanova <jaime@2ndquadrant.com>
2012-12-11 19:04 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
@ 2012-12-11 20:51 ` Jaime Casanova <jaime@2ndquadrant.com>
0 siblings, 0 replies; 17+ messages in thread
From: Jaime Casanova @ 2012-12-11 20:51 UTC (permalink / raw)
To: Jeff Janes <jeff.janes@gmail.com>; +Cc: Alvaro Herrera <alvherre@2ndquadrant.com>; Tom Lane <tgl@sss.pgh.pa.us>; spam_eater@gmx.net; pgsql-bugs
On Tue, Dec 11, 2012 at 2:04 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
>
> I am unsure of the goal here. The docs clearly say that only objects
> in the current database are affected, so why are we even trying to do
> something with tablespaces (or databases), which do not live in any
> database? And if we want to change the contract to allow it to climb
> out of the current database, why limit it to shared objects rather
> than crawling all databases?
>
ok. you're right, what i suggested before of making something similar
on DROP ASSIGNED is actually a violation of the POLA.
about your question, i guess the compromise Álvaro was taken here is
to affect all objects that could be *seen* from this database you
can't climb to other objects in other databases because they can't be
seen.
--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
Phone: +593 4 5107566 Cell: +593 987171157
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2013-01-24 03:06 ` Jeff Janes <jeff.janes@gmail.com>
2013-01-24 13:36 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-25 19:57 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
1 sibling, 2 replies; 17+ messages in thread
From: Jeff Janes @ 2013-01-24 03:06 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
On Sunday, December 9, 2012, Alvaro Herrera wrote:
> Tom Lane wrote:
> >
> > spam_eater@gmx.net <javascript:;> writes:
> > > postgres=# create user testuser with password 'secret';
> > > CREATE ROLE
> > > postgres=# create database testdb owner testuser;
> > > CREATE DATABASE
> > > testdb=> drop owned by testuser;
> > > ERROR: unrecognized object class: 1262
> >
> > I can reproduce this in all versions back to 8.3. In 8.2, the role's
> > ownership of the database is silently ignored, which I think was the
> > design intention. I doubt that we want DROP OWNED dropping whole
> > databases. At most maybe we should raise a NOTICE?
>
> I broke it recently: fe3b5eb08
>
> Got a one day old guy at home, can't look at this for at least a
> week, sorry.
>
Since back-branch releases are coming up, I think fe3b5eb08 and it's
analogues in all branches should be reverted.
The issue it was intended to solve was not really a bug in the first place,
and this patch didn't solve it anyway. But it introduced new behavior (into
all supported branches) which certainly is a bug.
I don't think the original issue it was intended to solve can be solved
easily, either. It would be easy to fix the code to add table-spaces to the
list of things to be reassigned, but the code that does the actual
reassignment can't deal with table-spaces anyway.
Cheers,
Jeff
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
@ 2013-01-24 13:36 ` Alvaro Herrera <alvherre@2ndquadrant.com>
1 sibling, 0 replies; 17+ messages in thread
From: Alvaro Herrera @ 2013-01-24 13:36 UTC (permalink / raw)
To: Jeff Janes <jeff.janes@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
Jeff Janes escribió:
> Since back-branch releases are coming up, I think fe3b5eb08 and it's
> analogues in all branches should be reverted.
Yes, I have this on my list of things to do before the next minor
release.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
@ 2013-01-25 19:57 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-25 20:15 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-26 01:09 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 2 replies; 17+ messages in thread
From: Alvaro Herrera @ 2013-01-25 19:57 UTC (permalink / raw)
To: Jeff Janes <jeff.janes@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
Jeff Janes escribió:
> Since back-branch releases are coming up, I think fe3b5eb08 and it's
> analogues in all branches should be reverted.
>
> The issue it was intended to solve was not really a bug in the first place,
> and this patch didn't solve it anyway. But it introduced new behavior (into
> all supported branches) which certainly is a bug.
I disagree with this assessment, and propose the attached patch instead.
The documentation for DROP OWNED says in its opening paragraph "Any
privileges granted to the given roles on objects in the current database
will also be revoked." So commit fe3b5eb08 was correct, though
incomplete; DROP OWNED is really supposed to operate on tablespaces and
databases. Not drop them, mind you --- but if the user has been granted
privileges on them, those should be revoked.
On the other hand, running REASSIGN OWNED means to reassign ownership of
objects to some other user. There is no reason this cannot be done to
shared objects as well as local objects. I note, though, that REASSIGN
OWNED's documentation mentions "objects in the current database"; but in
spirit, the point of it is to drop users. So applying to shared objects
seems within charter to me.
So what this patch does, is ensure that both REASSIGN OWNED and DROP
OWNED operate on shared objects: the former changes ownership of those
shared objects to the target user; and the latter removes granted
privileges on those shared objects.
This is the patch for the master branch; I have not tried to backpatch
it yet. Conflicts are expected due to the refactoring of ALTER commands
by KaiGai.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Attachments:
fix-drop-reassign-owned.patch (text/x-diff, 1.6K) download
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 86c6183..e411372 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -1240,11 +1240,14 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
sdepForm->objid);
break;
case SHARED_DEPENDENCY_OWNER:
- /* Save it for deletion below */
- obj.classId = sdepForm->classid;
- obj.objectId = sdepForm->objid;
- obj.objectSubId = sdepForm->objsubid;
- add_exact_object_address(&obj, deleteobjs);
+ /* If a local object, save it for deletion below */
+ if (sdepForm->dbid == MyDatabaseId)
+ {
+ obj.classId = sdepForm->classid;
+ obj.objectId = sdepForm->objid;
+ obj.objectSubId = sdepForm->objsubid;
+ add_exact_object_address(&obj, deleteobjs);
+ }
break;
}
}
@@ -1322,8 +1325,12 @@ shdepReassignOwned(List *roleids, Oid newrole)
{
Form_pg_shdepend sdepForm = (Form_pg_shdepend) GETSTRUCT(tuple);
- /* We only operate on objects in the current database */
- if (sdepForm->dbid != MyDatabaseId)
+ /*
+ * We only operate on shared objects and objects in the current
+ * database
+ */
+ if (sdepForm->dbid != MyDatabaseId &&
+ sdepForm->dbid != InvalidOid)
continue;
/* Unexpected because we checked for pins above */
@@ -1385,6 +1392,8 @@ shdepReassignOwned(List *roleids, Oid newrole)
case OperatorFamilyRelationId:
case OperatorClassRelationId:
case ExtensionRelationId:
+ case TableSpaceRelationId:
+ case DatabaseRelationId:
{
Oid classId = sdepForm->classid;
Relation catalog;
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
2013-01-25 19:57 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2013-01-25 20:15 ` Alvaro Herrera <alvherre@2ndquadrant.com>
1 sibling, 0 replies; 17+ messages in thread
From: Alvaro Herrera @ 2013-01-25 20:15 UTC (permalink / raw)
To: Jeff Janes <jeff.janes@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
Alvaro Herrera escribió:
> On the other hand, running REASSIGN OWNED means to reassign ownership of
> objects to some other user. There is no reason this cannot be done to
> shared objects as well as local objects. I note, though, that REASSIGN
> OWNED's documentation mentions "objects in the current database"; but in
> spirit, the point of it is to drop users. So applying to shared objects
> seems within charter to me.
FWIW, the docs for REASSIGN OWNED have a note at the bottom:
"The REASSIGN OWNED command does not affect the ownership of any
databases owned by the role."
This was added because Josh Berkus commanded us to:
http://www.postgresql.org/message-id/4BE2367C.30605@agliodbs.com
As far as I'm concerned, that note should be removed. Also, there's
this bit:
"Because REASSIGN OWNED only affects the objects in the current
database, it is usually necessary to execute this command in each
database that contains objects owned by a role that is to be removed."
This would be reworded thusly:
"Because REASSIGN OWNED does not affect objects in other
databases, it is usually necessary to execute this command in each
database that contains objects owned by a role that is to be removed."
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
2013-01-25 19:57 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2013-01-26 01:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-01-28 20:00 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
1 sibling, 1 reply; 17+ messages in thread
From: Tom Lane @ 2013-01-26 01:09 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Jeff Janes <jeff.janes@gmail.com>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> I disagree with this assessment, and propose the attached patch instead.
+1 for this approach in HEAD ...
> This is the patch for the master branch; I have not tried to backpatch
> it yet. Conflicts are expected due to the refactoring of ALTER commands
> by KaiGai.
... but I'm worried that you'd need a substantially larger patch in back
branches, and accordingly I'm not sure this is what to do in the back
branches. Without that refactoring, you might need to duplicate more
code, so it might be safer to just revert as Jeff suggested.
The documentation also needs more work than what you suggest in your
followup. The command reference pages should explicitly say that they
operate on both objects in the current database and shared objects.
Explicitly defining shared objects as databases and tablespaces
wouldn't hurt any.
It also strikes me that where you suggest "Because REASSIGN OWNED does
not affect objects in other databases ...", it might be clearer to say
"Because REASSIGN OWNED does not affect objects within other databases
...", which makes the idea of containment a little stronger.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
2013-01-25 19:57 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-26 01:09 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-01-28 20:00 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-28 20:04 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 17+ messages in thread
From: Alvaro Herrera @ 2013-01-28 20:00 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jeff Janes <jeff.janes@gmail.com>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
Tom Lane escribió:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > I disagree with this assessment, and propose the attached patch instead.
>
> +1 for this approach in HEAD ...
>
> > This is the patch for the master branch; I have not tried to backpatch
> > it yet. Conflicts are expected due to the refactoring of ALTER commands
> > by KaiGai.
>
> ... but I'm worried that you'd need a substantially larger patch in back
> branches, and accordingly I'm not sure this is what to do in the back
> branches. Without that refactoring, you might need to duplicate more
> code, so it might be safer to just revert as Jeff suggested.
I had a look at what it'd take to backpatch. For REASSIGN OWNED, you're
right that it'd require some refactoring, and it's probably not
worthwhile (the code is not really all that complicated). However, for
DROP OWNED the proposed hunks apply fine. Only 8.3 needs a different
patch, but it's only because whitespace is different.
So what we would end up with, is that DROP OWNED works for shared
objects (i.e. grants on tablespaces and databases are revoked), but
REASSIGN OWNED does not; so you're forced to do ALTER
DATABASE/TABLESPACE SET OWNER.
Since it's the grants that are more likely to cause headaches than
ownership when trying to drop users, I suggest that applying those
patches is the most convenient. (We know that this is a real problem
because of the bug reports we've gotten.)
> The documentation also needs more work than what you suggest in your
> followup. The command reference pages should explicitly say that they
> operate on both objects in the current database and shared objects.
> Explicitly defining shared objects as databases and tablespaces
> wouldn't hurt any.
>
> It also strikes me that where you suggest "Because REASSIGN OWNED does
> not affect objects in other databases ...", it might be clearer to say
> "Because REASSIGN OWNED does not affect objects within other databases
> ...", which makes the idea of containment a little stronger.
Okay, I will revise those proposed docs changes.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
2013-01-25 19:57 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-26 01:09 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2013-01-28 20:00 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2013-01-28 20:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-01-28 22:37 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 17+ messages in thread
From: Tom Lane @ 2013-01-28 20:04 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Jeff Janes <jeff.janes@gmail.com>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> I had a look at what it'd take to backpatch. For REASSIGN OWNED, you're
> right that it'd require some refactoring, and it's probably not
> worthwhile (the code is not really all that complicated). However, for
> DROP OWNED the proposed hunks apply fine. Only 8.3 needs a different
> patch, but it's only because whitespace is different.
> So what we would end up with, is that DROP OWNED works for shared
> objects (i.e. grants on tablespaces and databases are revoked), but
> REASSIGN OWNED does not; so you're forced to do ALTER
> DATABASE/TABLESPACE SET OWNER.
> Since it's the grants that are more likely to cause headaches than
> ownership when trying to drop users, I suggest that applying those
> patches is the most convenient. (We know that this is a real problem
> because of the bug reports we've gotten.)
Seems reasonable to me.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
2013-01-25 19:57 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-26 01:09 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2013-01-28 20:00 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-28 20:04 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-01-28 22:37 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-29 18:35 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
0 siblings, 1 reply; 17+ messages in thread
From: Alvaro Herrera @ 2013-01-28 22:37 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jeff Janes <jeff.janes@gmail.com>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
Pushed, thanks.
Jeff, Thomas, Jaime: please have a look and let me know what you think.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2012-12-10 04:13 ` Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-24 03:06 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Jeff Janes <jeff.janes@gmail.com>
2013-01-25 19:57 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-26 01:09 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2013-01-28 20:00 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-28 20:04 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Tom Lane <tgl@sss.pgh.pa.us>
2013-01-28 22:37 ` Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2013-01-29 18:35 ` Jeff Janes <jeff.janes@gmail.com>
0 siblings, 0 replies; 17+ messages in thread
From: Jeff Janes @ 2013-01-29 18:35 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; spam_eater@gmx.net <spam_eater@gmx.net>; pgsql-bugs; Jaime Casanova <jaime@2ndquadrant.com>
On Mon, Jan 28, 2013 at 2:37 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> Pushed, thanks.
>
> Jeff, Thomas, Jaime: please have a look and let me know what you think.
I've tested it in the 9_2_STABLE branch and found no problems.
Thanks,
Jeff
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 17+ messages in thread
end of thread, other threads:[~2013-01-29 18:35 UTC | newest]
Thread overview: 17+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-12-09 14:12 BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" spam_eater@gmx.net
2012-12-09 16:43 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-12-09 17:04 ` Thomas Kellerer <spam_eater@gmx.net>
2012-12-09 22:44 ` Thomas Kellerer <spam_eater@gmx.net>
2012-12-10 04:13 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2012-12-10 04:28 ` Jaime Casanova <jaime@2ndquadrant.com>
2012-12-11 19:04 ` Jeff Janes <jeff.janes@gmail.com>
2012-12-11 20:51 ` Jaime Casanova <jaime@2ndquadrant.com>
2013-01-24 03:06 ` Jeff Janes <jeff.janes@gmail.com>
2013-01-24 13:36 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-25 19:57 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-25 20:15 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-26 01:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-01-28 20:00 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-28 20:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-01-28 22:37 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-01-29 18:35 ` Jeff Janes <jeff.janes@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox