Skip site navigation (1) Skip section navigation (2)

record statement boundaries

From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: record statement boundaries
Date: 2006-02-17 04:21:50
Message-ID: 1140150110.31672.84.camel@localhost.localdomain (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Attached is a patch from Joachim Wieland that changes the parser to
optionally maintain a list of the source texts of the statements in the
input query string. Currently debug_query_string is used for that
purpose -- this is incorrect when multiple comma-separated statements
are concatenated together in a single query string.

The patch maintains the list by having the parser record when each
statement ends; the lexer's current position is used to determine the
source text that corresponds to the current statement. A new global
variable "current_statement" has been introduced to replace
"debug_query_string" (which has been removed).

Two issues/questions:

(1) Joachim's patch removes leading and trailing whitespace, and any
trailing semi-colon from the statement's text. Is this the right
behavior? I'm not sure, I can see an argument for both sides.

(2) Some of the logging code (e.g. log_after_parse(), the code for
log_min_duration_statement, etc.) needs to be updated to use
current_statement rather than the user-submitted query string. I'll do
that shortly.

Patch from Joachim Wieland, reviewed by Neil Conway.


Attachment: pg_debug_query_string.8.diff
Description: text/x-patch (15.1 KB)


pgsql-patches by date

Next:From: Tom LaneDate: 2006-02-17 06:15:22
Subject: Re: record statement boundaries
Previous:From: Peter EisentrautDate: 2006-02-16 23:25:35
Subject: Re: memset using long instead of int32

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group