Correctly propagate queryId for utility stmt in function

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Correctly propagate queryId for utility stmt in function
Date: 2024-07-18 11:37:40
Message-ID: CAO6_XqrGp-uwBqi3vBPLuRULKkddjC7R5QZCgsFren=8E+m2Sg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

For utility statements defined within a function, the queryTree is
copied to a plannedStmt as utility commands don't require planning.
However, the queryId is not propagated to the plannedStmt. This leads
to plugins relying on queryId like pg_stat_statements to not be able
to track utility statements within function calls.

This patch fixes the issue by correctly propagating queryId from the
cached queryTree to the plannedStmt.

Regards,
Anthonin

Attachment Content-Type Size
v1-0001-Correctly-propagate-queryId-for-utility-stmt-in-f.patch application/x-patch 4.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-07-18 11:42:46 Re: Slow catchup of 2PC (twophase) transactions on replica in LR
Previous Message Daniel Verite 2024-07-18 11:29:27 Re: Built-in CTYPE provider