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/2LvUBMf3k7Gmz9@paquier.xyz
Whole thread Raw
In response to Re: Force testing of query jumbling code in TAP tests  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Force testing of query jumbling code in TAP tests
List pgsql-hackers
On Thu, Feb 16, 2023 at 02:08:42PM +0900, Michael Paquier wrote:
> Other ideas are welcome.  At least this would be a start.

The main idea of the patch is here:

> +# Check some data from pg_stat_statements.
> +$node_primary->safe_psql('postgres', 'CREATE EXTENSION pg_stat_statements');
> +# This gathers data based on the first characters for some common query types,
> +# providing coverage for SELECT, DMLs, and some DDLs.
> +my $result = $node_primary->safe_psql(
> +    'postgres',
> +    qq{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;});
> +is( $result, qq(CREATE|t
> +DELETE|t
> +INSERT|t
> +SELECT|t
> +UPDATE|t), 'check contents of pg_stat_statements on regression database');

Are there any objections to do what's proposed in the patch and
improve the testing coverage of query jumbling by default?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Allow tests to pass in OpenSSL FIPS mode
Next
From: Bharath Rupireddy
Date:
Subject: Re: Improve WALRead() to suck data directly from WAL buffers when possible