Add some sanity checks in executor for query ID reporting
authorMichael Paquier <michael@paquier.xyz>
Wed, 18 Sep 2024 05:43:37 +0000 (14:43 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 18 Sep 2024 05:43:37 +0000 (14:43 +0900)
commit24f5205948093a96edf8213294b3d585ac3fe1fb
tree2d90b0b5871de21cae2959158c25335f9319fb8c
parent4f08ab55457751308ffd8d33e82155758cd0e304
Add some sanity checks in executor for query ID reporting

This commit adds three sanity checks in code paths of the executor where
it is possible to use hooks, checking that a query ID is reported in
pg_stat_activity if compute_query_id is enabled:
- ExecutorRun()
- ExecutorFinish()
- ExecutorEnd()

This causes the test in pg_stat_statements added in 933848d16dc9 to
complain immediately in ExecutorRun().  The idea behind this commit is
to help extensions to detect if they are missing query ID reports when a
query goes through the executor.  Perhaps this will prove to be a bad
idea, but let's see where this experience goes in v18 and newer
versions.

Reviewed-by: Sami Imseih
Discussion: https://postgr.es/m/ZuJb5xCKHH0A9tMN@paquier.xyz
src/backend/executor/execMain.c