Include RELKIND_TOASTVALUE in get_relkind_objtype - Mailing list pgsql-hackers

From Hsu, John
Subject Include RELKIND_TOASTVALUE in get_relkind_objtype
Date
Msg-id C652D3DF-2B0C-4128-9420-FB5379F6B1E4@amazon.com
Whole thread Raw
Responses Re: Include RELKIND_TOASTVALUE in get_relkind_objtype
List pgsql-hackers
Hello,

get_relkind_objtype(...) was introduced as part of 8b9e9644dc, and it doesn't include
RELKIND_TOASTVALUE. As a result when a user who has usage rights on schema pg_toast
and attempts to reindex a table it is not the owner of it fails with the wrong error
message.

testuser is a non-superuser role who has been granted all on pg_toast

postgres=> \c
You are now connected to database "postgres" as user "testuser".
postgres=> REINDEX TABLE pg_toast.pg_toast_16388;
ERROR:  unexpected relkind: 116

It seems get_relkind_objtype(...) is only used as part of aclcheck_error(...)
I've attached a patch to include RELKIND_TOASTVALUE in get_relkind_objtype. 
Now it fails with the proper error message.

postgres=> \c
You are now connected to database "postgres" as user "testuser".
postgres=> REINDEX TABLE pg_toast.pg_toast_16388;
ERROR:  must be owner of table pg_toast_16388

Cheers,

John H


Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Don't codegen deform code for virtual tuples in expr eval forscan fetch
Next
From: Michael Paquier
Date:
Subject: Re: SSL tests failing for channel_binding with OpenSSL <= 1.0.1