Re: Regression in statement locations - Mailing list pgsql-hackers

From jian he
Subject Re: Regression in statement locations
Date
Msg-id CACJufxF+Eh8BeByxi1N8erUS128ttVbYR+=7HbU+xQ-HYp-L7w@mail.gmail.com
Whole thread Raw
In response to Re: Regression in statement locations  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Tue, May 20, 2025 at 11:59 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Tue, May 20, 2025 at 08:38:47AM +0900, Michael Paquier wrote:
> > With the semicolon in place, stmt_len gets set for the last query of
> > the string.  Still digging more..
>
> And got it.  The problem is that we are failing to update the
> statement location in a couple of cases with subqueries, and that we
> should handle (p_stmt_len == 0) as of using the remaining bytes in
> the string when a location is available, but the code was too
> aggressive in thinking that the length = 0 case should be always
> discarded.
>

I was thinking of using strlen(pstate->p_sourcetext) -  qry->stmt_location;
in setQueryLocationAndLength,
then I saw your changes in the pg_overexplain module.

maybe put some comments on top of setQueryLocationAndLength
for (qry->stmt_len == 0) case, but i saw the comments on the bottom
of setQueryLocationAndLength.

Overall, it looks good to me.



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Adding null patch entry to cfbot/CommitFest
Next
From: Hannu Krosing
Date:
Subject: Please update the pgconf.dev Unconference notes