Re: query_id, pg_stat_activity, extended query protocol - Mailing list pgsql-hackers

From Anthonin Bonnefoy
Subject Re: query_id, pg_stat_activity, extended query protocol
Date
Msg-id CAO6_Xqp=-HX-Z5yXzELxUKY9=OdhzArkEsP+VA+x4HAfAUeuRA@mail.gmail.com
Whole thread Raw
In response to Re: query_id, pg_stat_activity, extended query protocol  (Michael Paquier <michael@paquier.xyz>)
Responses Re: query_id, pg_stat_activity, extended query protocol
List pgsql-hackers
On Thu, Jul 18, 2024 at 10:56 AM Michael Paquier <michael@paquier.xyz> wrote:
> Please attach things to your emails, if your repository disappears for
> a reason or another we would lose knowledge in the archives of the
> community lists.

Noted and thanks for the reminder, I'm still learning about mailing
list etiquette.

> I have not looked at that entirely in details, and I'd need to check
> if it is possible to use what's here for more predictible tests:
> https://www.postgresql.org/message-id/ZqCMCS4HUshUYjGc%40paquier.xyz

For the tests, there are limited possibilities to check whether a
query_id has been set correctly.
- Checking pg_stat_activity is not possible in the regress tests as
you need a second session to check the reported query_id.
- pg_stat_statements can be used indirectly but you're limited to how
pgss uses query_id. For example, it doesn't rely on queryId in
ExecutorRun.

A possible solution I've been thinking of is to use a test module. The
module will assert on whether the queryId is set or not in parse, plan
and executor hooks. It will also check if the queryId reported in
pgstat matches the queryId at the root level.

This allows us to check that the queryId is correctly set with the
extended protocol. I've also found some queries which will trigger a
failure (ctas and cursor usage) though this is probably a different
issue from the extended protocol issue.

Regards,
Anthonin

Attachment

pgsql-hackers by date:

Previous
From: Marcos Pegoraro
Date:
Subject: Detailed release notes
Next
From: Heikki Linnakangas
Date:
Subject: Re: Direct SSL connection and ALPN loose ends