@@ -801,7 +801,7 @@ pg_rewrite_query(Query *query)
801
801
new_list = copyObject (querytree_list );
802
802
/* This checks both copyObject() and the equal() routines... */
803
803
if (!equal (new_list , querytree_list ))
804
- elog (WARNING , "copyObject() failed to produce equal parse tree" );
804
+ elog (WARNING , "copyObject() failed to produce an equal rewritten parse tree" );
805
805
else
806
806
querytree_list = new_list ;
807
807
}
@@ -813,35 +813,25 @@ pg_rewrite_query(Query *query)
813
813
List * new_list = NIL ;
814
814
ListCell * lc ;
815
815
816
- /*
817
- * We currently lack outfuncs/readfuncs support for most utility
818
- * statement types, so only attempt to write/read non-utility queries.
819
- */
820
816
foreach (lc , querytree_list )
821
817
{
822
818
Query * query = lfirst_node (Query , lc );
819
+ char * str = nodeToString (query );
820
+ Query * new_query = stringToNodeWithLocations (str );
823
821
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 ;
834
827
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 );
840
830
}
841
831
842
832
/* This checks both outfuncs/readfuncs and the equal() routines... */
843
833
if (!equal (new_list , querytree_list ))
844
- elog (WARNING , "outfuncs/readfuncs failed to produce equal parse tree" );
834
+ elog (WARNING , "outfuncs/readfuncs failed to produce an equal rewritten parse tree" );
845
835
else
846
836
querytree_list = new_list ;
847
837
}
0 commit comments