Skip to content

Commit 40ad8f9

Browse files
tglsfdcpetere
authored andcommitted
Implement WRITE_READ_PARSE_PLAN_TREES for raw parse trees
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us
1 parent acd6246 commit 40ad8f9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/backend/tcop/postgres.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,10 +603,22 @@ pg_parse_query(const char *query_string)
603603
#endif
604604

605605
/*
606-
* Currently, outfuncs/readfuncs support is missing for many raw parse
607-
* tree nodes, so we don't try to implement WRITE_READ_PARSE_PLAN_TREES
608-
* here.
606+
* Optional debugging check: pass raw parsetrees through
607+
* outfuncs/readfuncs
609608
*/
609+
#ifdef WRITE_READ_PARSE_PLAN_TREES
610+
{
611+
char *str = nodeToString(raw_parsetree_list);
612+
List *new_list = stringToNodeWithLocations(str);
613+
614+
pfree(str);
615+
/* This checks both outfuncs/readfuncs and the equal() routines... */
616+
if (!equal(new_list, raw_parsetree_list))
617+
elog(WARNING, "outfuncs/readfuncs failed to produce an equal raw parse tree");
618+
else
619+
raw_parsetree_list = new_list;
620+
}
621+
#endif
610622

611623
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
612624

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy