pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix "unexpected relkind" error when denying permissions on toast
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix "unexpected relkind" error when denying permissions on toast
@ 2019-11-05 18:40 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-11-05 18:40 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a30531c5c8a384363d410d4027e1c1eeed76e550

Modified Files
--------------
src/backend/catalog/objectaddress.c        | 28 +++++++++++++++++++++-------
src/backend/commands/alter.c               | 12 +++++-------
src/test/regress/expected/create_index.out |  9 +++++++++
src/test/regress/sql/create_index.sql      |  7 +++++++
4 files changed, 42 insertions(+), 14 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix "unexpected relkind" error when denying permissions on toast
@ 2019-11-05 18:40 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-11-05 18:40 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/791864193636764b4cbba0acd2b4eab7581eb2c3

Modified Files
--------------
src/backend/catalog/objectaddress.c        | 28 +++++++++++++++++++++-------
src/backend/commands/alter.c               | 12 +++++-------
src/test/regress/expected/create_index.out |  9 +++++++++
src/test/regress/sql/create_index.sql      |  7 +++++++
4 files changed, 42 insertions(+), 14 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix "unexpected relkind" error when denying permissions on toast
@ 2019-11-05 18:40 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-11-05 18:40 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2bfe015b5626be7f9837b0d1b31438fa896da427

Modified Files
--------------
src/backend/catalog/objectaddress.c        | 28 +++++++++++++++++++++-------
src/backend/commands/alter.c               | 12 +++++-------
src/test/regress/expected/create_index.out |  9 +++++++++
src/test/regress/sql/create_index.sql      |  7 +++++++
4 files changed, 42 insertions(+), 14 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-11-05 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 18:40 pgsql: Fix "unexpected relkind" error when denying permissions on toast Tom Lane <tgl@sss.pgh.pa.us>
2019-11-05 18:40 pgsql: Fix "unexpected relkind" error when denying permissions on toast Tom Lane <tgl@sss.pgh.pa.us>
2019-11-05 18:40 pgsql: Fix "unexpected relkind" error when denying permissions on toast Tom Lane <tgl@sss.pgh.pa.us>

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