Re: pg_stat_statements: more test coverage
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-12-27T12:53:06Z
Lists: pgsql-hackers
Attachments
- v2-0001-pg_stat_statements-Exclude-from-lcov-functions-th.patch (text/plain) patch v2-0001
- v2-0002-pg_stat_statements-Add-coverage-for-entry_dealloc.patch (text/plain) patch v2-0002
- v2-0003-pg_stat_statements-Add-TAP-test-for-testing-resta.patch (text/plain) patch v2-0003
On 27.12.23 09:08, Julien Rouhaud wrote:
> Hi,
>
> On Tue, Dec 26, 2023 at 10:03 PM Peter Eisentraut <peter@eisentraut.org> wrote:
>>
>> On 24.12.23 03:03, Michael Paquier wrote:
>>> - Use a DO block of a PL function, say with something like that to
>>> ensure an amount of N queries? Say with something like that after
>>> tweaking pg_stat_statements.track:
>>> CREATE OR REPLACE FUNCTION create_tables(num_tables int)
>>> RETURNS VOID AS
>>> $func$
>>> BEGIN
>>> FOR i IN 1..num_tables LOOP
>>> EXECUTE format('
>>> CREATE TABLE IF NOT EXISTS %I (id int)', 't_' || i);
>>> END LOOP;
>>> END
>>> $func$ LANGUAGE plpgsql;
>>
>> I tried it like this first, but this doesn't register as separately
>> executed commands for pg_stat_statements.
>
> I was a bit surprised by that so I checked locally. It does work as
> expected provided that you set pg_stat_statements.track to all:
Ok, here is an updated patch set that does it that way.
I have committed the patches 0002 and 0003 from the previous patch set
already.
I have also enhanced the TAP test a bit to check the actual content of
the output across restarts.
I'm not too hung up on the 0001 patch if others don't like that approach.
Commits
-
Revert "pg_stat_statements: Add coverage for entry_dealloc()"
- 1141e29b61e9 17.0 landed
-
pg_stat_statements: Add TAP test for testing restarts
- 4710b67d4d35 17.0 landed
-
pg_stat_statements: Add coverage for entry_dealloc()
- 742f6b3e6df9 17.0 landed
-
pg_stat_statements: Add test coverage for pg_stat_statements_1_8()
- 3727b8d0e3f1 17.0 landed
-
pg_stat_statements: Add test coverage for pg_stat_statements_reset_1_7
- 3e527aeeedb0 17.0 landed