Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit787102b

Browse files
tglsfdcpetere
authored andcommitted
Enable WRITE_READ_PARSE_PLAN_TREES of rewritten utility statements
This was previously disabled because we lacked outfuncs/readfuncssupport for most utility statement types.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us
1 parent40ad8f9 commit787102b

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ pg_rewrite_query(Query *query)
801801
new_list=copyObject(querytree_list);
802802
/* This checks both copyObject() and the equal() routines... */
803803
if (!equal(new_list,querytree_list))
804-
elog(WARNING,"copyObject() failed to produce equal parse tree");
804+
elog(WARNING,"copyObject() failed to produceanequal rewritten parse tree");
805805
else
806806
querytree_list=new_list;
807807
}
@@ -813,35 +813,25 @@ pg_rewrite_query(Query *query)
813813
List*new_list=NIL;
814814
ListCell*lc;
815815

816-
/*
817-
* We currently lack outfuncs/readfuncs support for most utility
818-
* statement types, so only attempt to write/read non-utility queries.
819-
*/
820816
foreach(lc,querytree_list)
821817
{
822818
Query*query=lfirst_node(Query,lc);
819+
char*str=nodeToString(query);
820+
Query*new_query=stringToNodeWithLocations(str);
823821

824-
if (query->commandType!=CMD_UTILITY)
825-
{
826-
char*str=nodeToString(query);
827-
Query*new_query=stringToNodeWithLocations(str);
828-
829-
/*
830-
* queryId is not saved in stored rules, but we must preserve
831-
* it here to avoid breaking pg_stat_statements.
832-
*/
833-
new_query->queryId=query->queryId;
822+
/*
823+
* queryId is not saved in stored rules, but we must preserve it
824+
* here to avoid breaking pg_stat_statements.
825+
*/
826+
new_query->queryId=query->queryId;
834827

835-
new_list=lappend(new_list,new_query);
836-
pfree(str);
837-
}
838-
else
839-
new_list=lappend(new_list,query);
828+
new_list=lappend(new_list,new_query);
829+
pfree(str);
840830
}
841831

842832
/* This checks both outfuncs/readfuncs and the equal() routines... */
843833
if (!equal(new_list,querytree_list))
844-
elog(WARNING,"outfuncs/readfuncs failed to produce equal parse tree");
834+
elog(WARNING,"outfuncs/readfuncs failed to produceanequal rewritten parse tree");
845835
else
846836
querytree_list=new_list;
847837
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp