mirror of
https://github.com/postgres/postgres.git
synced 2025-12-16 16:42:29 +03:00
Fix "unexpected relkind" error when denying permissions on toast tables.
get_relkind_objtype, and hence get_object_type, failed when applied to a toast table. This is not a good thing, because it prevents reporting of perfectly legitimate permissions errors. (At present, these functions are in fact *only* used to determine the ObjectType argument for acl_error() calls.) It seems best to have them fall back to returning OBJECT_TABLE in every case where they can't determine an object type for a pg_class entry, so do that. In passing, make some edits to alter.c to make it more obvious that those calls of get_object_type() are used only for error reporting. This might save a few cycles in the non-error code path, too. Back-patch to v11 where this issue originated. John Hsu, Michael Paquier, Tom Lane Discussion: https://postgr.es/m/C652D3DF-2B0C-4128-9420-FB5379F6B1E4@amazon.com
This commit is contained in:
@@ -1126,9 +1126,16 @@ END;
|
||||
CREATE ROLE regress_reindexuser NOLOGIN;
|
||||
SET SESSION ROLE regress_reindexuser;
|
||||
REINDEX SCHEMA schema_to_reindex;
|
||||
-- Permission failures with toast tables and indexes (pg_proc's toast here)
|
||||
RESET ROLE;
|
||||
GRANT USAGE ON SCHEMA pg_toast TO regress_reindexuser;
|
||||
SET SESSION ROLE regress_reindexuser;
|
||||
REINDEX TABLE pg_toast.pg_toast_1255;
|
||||
REINDEX INDEX pg_toast.pg_toast_1255_index;
|
||||
|
||||
-- Clean up
|
||||
RESET ROLE;
|
||||
REVOKE USAGE ON SCHEMA pg_toast FROM regress_reindexuser;
|
||||
DROP ROLE regress_reindexuser;
|
||||
\set VERBOSITY terse \\ -- suppress cascade details
|
||||
DROP SCHEMA schema_to_reindex CASCADE;
|
||||
|
||||
Reference in New Issue
Block a user