Re: Force testing of query jumbling code in TAP tests

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Force testing of query jumbling code in TAP tests
Дата
Msg-id Y+26WqwXEWRgeZgN@paquier.xyz
обсуждение исходный текст
Ответ на Re: Force testing of query jumbling code in TAP tests  (Andres Freund <andres@anarazel.de>)
Ответы Re: Force testing of query jumbling code in TAP tests  (Michael Paquier <michael@paquier.xyz>)
Список 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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dilip Kumar
Дата:
Сообщение: Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy
Следующее
От: "Takamichi Osumi (Fujitsu)"
Дата:
Сообщение: RE: Allow logical replication to copy tables in binary format