pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #13809: Reassign owned throws error
4+ messages / 3 participants
[nested] [flat]
* BUG #13809: Reassign owned throws error
@ 2015-12-09 11:26 alexander.ashurkov@gmail.com
2015-12-09 21:09 ` Re: BUG #13809: Reassign owned throws error Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 4+ messages in thread
From: alexander.ashurkov@gmail.com @ 2015-12-09 11:26 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 13809
Logged by: Alexander Ashurkov
Email address: alexander.ashurkov@gmail.com
PostgreSQL version: 9.4.5
Operating system: Linux 3.19.0-31-generic #36~14.04.1-Ubuntu SMP Thu
Description:
Hello,
when I execute "reassign owned by user to user_role" command (even with
'postgres' user) postgresql outputs this message:
"ERROR: unexpected classid 1418
SQL state: XX000"
My DB has postgresql FDW (it owned by 'postgres' user as it should be), one
foreign server (owned by 'user_role') and two user mappings for 'user' and
'user_role'.
'user' is member of 'user_role' ('GRANT user_role TO user').
Postgresql installed from "deb http://apt.postgresql.org/pub/repos/apt/
trusty-pgdg main" repo.
With version 9.4.4 it worked fine. Do I miss something or it is a bug?
--
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] 4+ messages in thread
* Re: BUG #13809: Reassign owned throws error
2015-12-09 11:26 BUG #13809: Reassign owned throws error alexander.ashurkov@gmail.com
@ 2015-12-09 21:09 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2015-12-10 15:14 ` Re: BUG #13809: Reassign owned throws error Alexander Ashurkov <alexander.ashurkov@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Alvaro Herrera @ 2015-12-09 21:09 UTC (permalink / raw)
To: alexander.ashurkov@gmail.com; +Cc: pgsql-bugs
alexander.ashurkov@gmail.com wrote:
> Hello,
> when I execute "reassign owned by user to user_role" command (even with
> 'postgres' user) postgresql outputs this message:
> "ERROR: unexpected classid 1418
> SQL state: XX000"
>
> My DB has postgresql FDW (it owned by 'postgres' user as it should be), one
> foreign server (owned by 'user_role') and two user mappings for 'user' and
> 'user_role'.
>
> 'user' is member of 'user_role' ('GRANT user_role TO user').
>
> Postgresql installed from "deb http://apt.postgresql.org/pub/repos/apt/
> trusty-pgdg main" repo.
Interesting, thanks. I think this should be dealt with just like
default ACLs: REASSIGN OWNED should just ignore the USER MAPPING
objects (because they aren't "owned" as such, but they go together with
the role itself), and they would be removed by DROP OWNED. So the
attached patch would fix it.
One could instead consider that this needs to be fixed by creating a
user mapping for the receiving user instead. But this seems way too
complicated: in particular, if such a user mapping already exists, we
would have to instead do nothing. I think that would run counter to the
current simplicity of REASSIGN OWNED.
This is not a for-commit patch; I need to verify what happens with FDWs
and foreign servers and such. FDWs and servers *are* owned, so fixing
those would require a different patch.
My current assumption is that the whole FDW machinery just didn't
account for REASSIGN OWNED at all.
Also, need to put some test cases somewhere.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, 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:
reassign-user-mapping.patch (text/x-diff, 667B) download
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 15fda71..bfe111e 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -43,6 +43,7 @@
#include "catalog/pg_ts_config.h"
#include "catalog/pg_ts_dict.h"
#include "catalog/pg_type.h"
+#include "catalog/pg_user_mapping.h"
#include "commands/alter.h"
#include "commands/dbcommands.h"
#include "commands/collationcmds.h"
@@ -1367,6 +1368,7 @@ shdepReassignOwned(List *roleids, Oid newrole)
break;
case DefaultAclRelationId:
+ case UserMappingRelationId:
/*
* Ignore default ACLs; they should be handled by DROP
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #13809: Reassign owned throws error
2015-12-09 11:26 BUG #13809: Reassign owned throws error alexander.ashurkov@gmail.com
2015-12-09 21:09 ` Re: BUG #13809: Reassign owned throws error Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2015-12-10 15:14 ` Alexander Ashurkov <alexander.ashurkov@gmail.com>
2015-12-11 21:49 ` Re: BUG #13809: Reassign owned throws error Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Ashurkov @ 2015-12-10 15:14 UTC (permalink / raw)
To: ; +Cc: pgsql-bugs
Alvaro, I compiled postgres with your patch on test machine and copied my
DB there, now reassign command works fine!
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #13809: Reassign owned throws error
2015-12-09 11:26 BUG #13809: Reassign owned throws error alexander.ashurkov@gmail.com
2015-12-09 21:09 ` Re: BUG #13809: Reassign owned throws error Alvaro Herrera <alvherre@2ndquadrant.com>
2015-12-10 15:14 ` Re: BUG #13809: Reassign owned throws error Alexander Ashurkov <alexander.ashurkov@gmail.com>
@ 2015-12-11 21:49 ` Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 0 replies; 4+ messages in thread
From: Alvaro Herrera @ 2015-12-11 21:49 UTC (permalink / raw)
To: Alexander Ashurkov <alexander.ashurkov@gmail.com>; +Cc: pgsql-bugs
Alexander Ashurkov wrote:
> Alvaro, I compiled postgres with your patch on test machine and copied my
> DB there, now reassign command works fine!
Thanks for the followup. I just pushed this patch.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, 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] 4+ messages in thread
end of thread, other threads:[~2015-12-11 21:49 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 11:26 BUG #13809: Reassign owned throws error alexander.ashurkov@gmail.com
2015-12-09 21:09 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2015-12-10 15:14 ` Alexander Ashurkov <alexander.ashurkov@gmail.com>
2015-12-11 21:49 ` Alvaro Herrera <alvherre@2ndquadrant.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