Re: [HACKERS] BUG: pg_stat_statements query normalization issues withcombined queries

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: [HACKERS] BUG: pg_stat_statements query normalization issues withcombined queries
Дата
Msg-id CAMsr+YHD7whzhCyPgwK_qkrec_Zmcnpdp6MFeTDe0zfZahyKNA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] BUG: pg_stat_statements query normalization issues with combined queries  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] BUG: pg_stat_statements query normalization issues with combined queries  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 15 January 2017 at 05:18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Fabien COELHO <coelho@cri.ensmp.fr> writes:
>>> It ends up being about 30 fewer lines of code overall, despite there
>>> being four places that have to make ad-hoc RawStmt nodes.  On the whole
>>> I feel like this is cleaner,
>
>> I agree: Better typing, more homogeneous code (PlannedStmt for all),
>> less ad-hoc checks to work around utility statements...
>
> OK, pushed like that.


Thanks very much for that Tom, it's great to see this change.

One suggestion: it's currently non-obvious that ProcessUtility_hook
gets called with the full text of all parts of a multi-statement. I
suggest the following wording added to the comment on ProcessUtility()
in src/backend/tcop/utility.c, after the note on the query string, or
something like it:

 The same query string may be passed to multiple invocations of ProcessUtility if a utility statement in turn invokes
otherutility statements, or if the user supplied a query string containing multiple semicolon-separated statements in a
singleprotocol message. It is also possible for the query text to contain other non-utility-statement text like
comments,empty statements, and plannable statements. Callers that use the queryString should use pstmt->stmt_location
andpstmt->stmt_len to extract the text for the statement of interest and should guard against re-entrant invocation.
 


That should help with at least some of the traps around
ProcessUtility_hook, and I certainly wish I'd known it some months
ago.



For the record, this is commits
ab1f0c8225714aaa18d2f9ca4f80cd009f145421 and
83f2061dd037477ec8479ee160367840e203a722 .

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=ab1f0c8225714aaa18d2f9ca4f80cd009f145421

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=83f2061dd037477ec8479ee160367840e203a722

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Remote DBA, Training
&Services
 



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] pg_hba_file_settings view patch
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] pg_ls_dir & friends still have a hard-coded superuser check