Re: Add privileges test for pg_stat_statements to improve coverage

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: kuroda(dot)keisuke(at)nttcom(dot)co(dot)jp, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add privileges test for pg_stat_statements to improve coverage
Date: 2024-07-19 19:16:46
Message-ID: aaa8caa6-7f1f-4178-8067-010515d2c158@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024/04/23 15:44, kuroda(dot)keisuke(at)nttcom(dot)co(dot)jp wrote:
> Hi hackers,
>
> I proposal adding privileges test to improve
> test coverage of pg_stat_statements.

+1

Here are the review comments:

meson.build needs to be updated as well, like the Makefile.

For the privileges test, should we explicitly set pg_stat_statements.track_utility
at the start, as done in other pg_stat_statements tests, to make sure
if utility command statistics are collected or not?

+SELECT
+ CASE
+ WHEN queryid <> 0 THEN TRUE ELSE FALSE
+ END AS queryid_bool
+ ,query FROM pg_stat_statements ORDER BY query COLLATE "C";

Can't we simplify "CASE ... END" to just "queryid <> 0"?

Should the test check not only queryid and query but also
the statistics column like "calls"? Roles that aren't superusers
or pg_read_all_stats should be able to see statistics but not
query or queryid. So we should test that such roles can't see
query or queryid but can see statistics. Thoughts?

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alena Rybakina 2024-07-19 19:19:55 Re: Evaluate arguments of correlated SubPlans in the referencing ExprState
Previous Message Laurenz Albe 2024-07-19 19:06:57 Re: [18] Policy on IMMUTABLE functions and Unicode updates