Re: Cleaning up PREPARE query strings?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Cleaning up PREPARE query strings?
Date: 2025-12-24 16:21:00
Message-ID: 928501.1766593260@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Julien Rouhaud <rjuju123(at)gmail(dot)com> writes:
> I'm attaching a POC patch to fix that behavior by teaching PREPARE to clean the
> passed query text the same way as pg_stat_statements.

This patch invalidates all the location fields in the parsed query:
they could not be used to generate sane error cursors referencing the
truncated string. I'm not sure how many places try to generate such
errors post-parsing, but it's more than zero, and I've long had
ambitions of trying to extend that substantially (e.g, allowing
execution-time errors from functions to point at the relevant function
call).

Certainly the patch could be extended to update all those fields,
but that increases its complexity very significantly. I doubt
that it's worth it. My reaction to your example is more like
"if that bothers you, don't do it that way".

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2025-12-24 16:23:11 Re: SQL Property Graph Queries (SQL/PGQ)
Previous Message Julien Rouhaud 2025-12-24 15:43:13 Cleaning up PREPARE query strings?