Re: [Patch] Invalid permission check in pg_stats for functional indexes - Mailing list pgsql-hackers

From Kuntal Ghosh
Subject Re: [Patch] Invalid permission check in pg_stats for functional indexes
Date
Msg-id CAGz5QC+GDXSDaw1snvK36h3Py2g+Z+sQEcmMUrupRGmewCQ0Xg@mail.gmail.com
Whole thread Raw
In response to [Patch] Invalid permission check in pg_stats for functional indexes  (Pierre Ducroquet <p.psql@pinaraf.info>)
Responses Re: [Patch] Invalid permission check in pg_stats for functional indexes
List pgsql-hackers
Hello Pierre,

> When using a functional index on a table, we realized that the permission
> check done in pg_stats was incorrect and thus preventing valid access to the
> statistics from users.
>
> The attached patch fixes this by introducing a second path in privilege check
> in pg_stats view.
The patch doesn't apply on the latest HEAD [1].
IIUC, the patch introduces an additional privilege check for the
underlying objects involved in the expression/functional index. If the
user has 'select' privileges on all of the columns/objects included in
the expression/functional index, then it should be visible in pg_stats
view. I've applied the patch manually and tested the feature. It works
as expected.

> I have not written a regression test yet, mainly because I'm not 100% certain
> where to write it. Given some hints, I would happily add it to this patch.
>
Yeah, it'll be good to have some regression tests for the same. I'm
also not sure which regression file best suites for these tests.

[1] http://cfbot.cputube.org/patch_24_2274.log

-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: PATCH: logical_work_mem and logical streaming of largein-progress transactions
Next
From: Fabien COELHO
Date:
Subject: Re: pgbench - rework variable management