Re: Force testing of query jumbling code in TAP tests

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Force testing of query jumbling code in TAP tests
Date: 2023-02-16 05:08:42
Message-ID: Y+26WqwXEWRgeZgN@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 14, 2023 at 10:11:21AM -0800, Andres Freund wrote:
> I didn't mean printing in the sense of outputting the statements to the tap
> log. Maybe creating a temp table or such for all the queries. And yes, then
> doing some top-level analysis on it like you describe sounds like a good idea.

One idea would be something like that, that makes sure that reports
are generated for the most common query patterns:
WITH select_stats AS
(SELECT upper(substr(query, 1, 6)) AS select_query
FROM pg_stat_statements
WHERE upper(substr(query, 1, 6)) IN ('SELECT', 'UPDATE',
'INSERT', 'DELETE',
'CREATE'))
SELECT select_query, count(select_query) > 1 AS some_rows
FROM select_stats
GROUP BY select_query ORDER BY select_query;

Other ideas are welcome. At least this would be a start.
--
Michael

Attachment Content-Type Size
query_jumble_test_v2.patch text/x-diff 2.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Takamichi Osumi (Fujitsu) 2023-02-16 05:16:51 RE: Allow logical replication to copy tables in binary format
Previous Message Dilip Kumar 2023-02-16 04:54:13 Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy