Re: Force testing of query jumbling code in TAP tests - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Force testing of query jumbling code in TAP tests
Date
Msg-id Y+26WqwXEWRgeZgN@paquier.xyz
Whole thread Raw
In response to Re: Force testing of query jumbling code in TAP tests  (Andres Freund <andres@anarazel.de>)
Responses Re: Force testing of query jumbling code in TAP tests
List 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

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy
Next
From: "Takamichi Osumi (Fujitsu)"
Date:
Subject: RE: Allow logical replication to copy tables in binary format