Re: Cleaning up PREPARE query strings? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Cleaning up PREPARE query strings?
Date
Msg-id 928501.1766593260@sss.pgh.pa.us
Whole thread Raw
In response to Cleaning up PREPARE query strings?  (Julien Rouhaud <rjuju123@gmail.com>)
Responses Re: Cleaning up PREPARE query strings?
List pgsql-hackers
Julien Rouhaud <rjuju123@gmail.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



pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Cleaning up PREPARE query strings?
Next
From: Henson Choi
Date:
Subject: Re: SQL Property Graph Queries (SQL/PGQ)