[pgpool-hackers: 4290] minimal parser and multi-statement query
Tatsuo Ishii
ishii at sraoss.co.jp
Sun Feb 19 15:48:28 JST 2023
Hi Usama,
While taking care of this:
https://www.pgpool.net/mantisbt/view.php?id=780
I realized that pgpool fails to judge whether a query is
multi-statement or not, if clustering mode is streaming/logical
replication and the multi-statement query includes INSERT or UPDATE
statements. This is because our minimal-parser returns single parse
tree for multi-statement queries including INSERT/UPDATE statements.
gram_minimal.y:
InsertStmtShort:
opt_with_clause INSERT INTO insert_target
{
InsertStmt *insert = makeNode(InsertStmt);
insert->relation = $4;
$$ = (Node *) insert;
/*
* Assign the node directly to the parsetree and exit the scanner
* we don't want to keep parsing for information we don't need
*/
pg_yyget_extra(yyscanner)->parsetree = list_make1(makeRawStmt($$, 0));
YYACCEPT;
}
;
As a result, the test below in SimpleQuery() fails to set
is_multi_statement to true even if the query is a multi-statement
query.
if (parse_tree_list && list_length(parse_tree_list) > 1)
{
query_context->is_multi_statement = true;
}
else
{
query_context->is_multi_statement = false;
}
We could avoid this without using the minimal parser but it will take
more time to parse lengthy INSERT/UPDATE queries.
Is there any workaround for this?
Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
More information about the pgpool-hackers
mailing list