RangeTblEntry jumble omissions

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RangeTblEntry jumble omissions
Date: 2024-02-23 15:26:53
Message-ID: d7f421f8-fd6d-4759-adc3-247090a5d44b@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I think there are some fields from the RangeTblEntry struct missing in
the jumble (function _jumbleRangeTblEntry()). Probably, some of these
were really just forgotten, in other cases this might be an intentional
decision, but then it might be good to document it. This has come up in
thread [0] and there is a patch [1], but I figured I'd start a new
thread here to get the attention of those who know more about
pg_stat_statements.

I think the following fields are missing. (See also attached patch.)

- alias

Currently, two queries like

SELECT * FROM t1 AS foo
SELECT * FROM t1 AS bar

are counted together by pg_stat_statements -- that might be ok, but they
both get listed under whichever one is run first, so here if you are
looking for the "AS bar" query, you won't find it.

- join_using_alias

Similar situation, currently

SELECT * FROM t1 JOIN t2 USING (a, b)
SELECT * FROM t1 JOIN t2 USING (a, b) AS x

are counted together.

- funcordinality

This was probably just forgotten. It should be included because the
WITH ORDINALITY clause changes the query result.

- lateral

Also probably forgotten. A query specifying LATERAL is clearly
different from one without it.

Thoughts? Anything else missing perhaps?

[0]:
https://www.postgresql.org/message-id/flat/4b27fc50-8cd6-46f5-ab20-88dbaadca645(at)eisentraut(dot)org
[1]:
https://www.postgresql.org/message-id/attachment/154249/v2-0002-Remove-custom-_jumbleRangeTblEntry.patch

Attachment Content-Type Size
0001-Add-more-RangeTblEntry-fields-to-jumble.patch text/plain 1.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2024-02-23 15:39:47 Re: Printing backtrace of postgres processes
Previous Message Robert Haas 2024-02-23 15:23:22 Re: RFC: Logging plan of the running query