Re: Set query_id for query contained in utility statement

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Set query_id for query contained in utility statement
Date: 2024-10-15 08:11:40
Message-ID: CAO6_XqqMYOxJmHJWCKjP44T9AsW0MmKV87XUYCP3R9JZvYcVaw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've found that COPY wasn't correctly managed. "COPY (SELECT 1) to
stdout;" nested statement would be tracked as "SELECT $1) to stdout".
Since COPY accepts a PreparableStmt, stmt_len for all types of
PreparableStmt needs to be tracked. This is done through
updatePreparableStmtEnd in CopyStmt since we know the location of the
closing parenthesis. The logic to set Query->stmt_len for statements
that have a possible stmt_len has also been moved to a dedicated
setQueryStmtLen function.

I've updated the patchset with additional tests for COPY in 0001. 0002
includes the necessary modifications to handle COPY.

Attachment Content-Type Size
v8-0002-Track-location-to-extract-relevant-part-in-nested.patch application/octet-stream 39.7 KB
v8-0003-Set-query_id-for-queries-contained-in-utility-sta.patch application/octet-stream 22.5 KB
v8-0004-Use-view-s-definition-as-query-string-on-a-materi.patch application/octet-stream 6.1 KB
v8-0001-Add-tests-covering-pgss-nested-queries.patch application/octet-stream 56.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-10-15 08:20:48 Re: [PATCH] Move clause_sides_match_join() into pathnode.h
Previous Message Alexander Korotkov 2024-10-15 08:08:54 Re: type cache cleanup improvements