Re: Add privileges test for pg_stat_statements to improve coverage - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Add privileges test for pg_stat_statements to improve coverage
Date
Msg-id aaa8caa6-7f1f-4178-8067-010515d2c158@oss.nttdata.com
Whole thread Raw
In response to Add privileges test for pg_stat_statements to improve coverage  (kuroda.keisuke@nttcom.co.jp)
Responses Re: Add privileges test for pg_stat_statements to improve coverage
List pgsql-hackers

On 2024/04/23 15:44, kuroda.keisuke@nttcom.co.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



pgsql-hackers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: [18] Policy on IMMUTABLE functions and Unicode updates
Next
From: Alena Rybakina
Date:
Subject: Re: Evaluate arguments of correlated SubPlans in the referencing ExprState