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-22 16:51:19
Message-ID: 86efadd7-86a0-436f-8ce7-27a44f4f50e1@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024/07/22 15:23, kuroda(dot)keisuke(at)nttcom(dot)co(dot)jp wrote:
> Hi Fujii-san,
> Thank you for your reply and comment!
>
> attach v2 fixed patch.

Thanks for updating the patch!

+SELECT query, calls, rows FROM pg_stat_statements
+ WHERE queryid IS NULL ORDER BY query COLLATE "C";

Shouldn't we also include calls and rows in the ORDER BY clause?
Without this, if there are multiple records with the same query
but different calls or rows, the query result might be unstable.
I believe this is causing the test failure reported by
he PostgreSQL Patch Tester.

http://cfbot.cputube.org/
https://cirrus-ci.com/task/4533613939654656

> Yes.
> If we add "queryid <> 0" to the WHERE clause, we can get the same result.
> Change the SQL to the following:
>
> +SELECT query, calls, rows FROM pg_stat_statements
> +  WHERE queryid <> 0 ORDER BY query COLLATE "C";

I was thinking of adding "queryid <> 0" in the SELECT clause
instead of the WHERE clause. This way, we can verify if
the query results are as expected regardless of the queryid value,
including both queryid <> 0 and queryid = 0.

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 Ahmed Yarub Hani Al Nuaimi 2024-07-22 16:59:56 Re: Lock-free compaction. Why not?
Previous Message Andres Freund 2024-07-22 16:47:45 Re: Vacuum ERRORs out considering freezing dead tuples from before OldestXmin