diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-09-26 16:32:16 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-09-26 16:32:16 +0200 |
commit | 40ad8f9deed21f02b23eb034bfca87f7acc7562b (patch) | |
tree | 6163cce4b38aecca11081bb4e96046d0c89fff69 /src/backend/tcop/postgres.c | |
parent | acd624644bc4f957824abcd00f6af27861b03a29 (diff) | |
download | postgresql-40ad8f9deed21f02b23eb034bfca87f7acc7562b.tar.gz postgresql-40ad8f9deed21f02b23eb034bfca87f7acc7562b.zip |
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
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 35eff28bd36..4952d011836 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -603,10 +603,22 @@ pg_parse_query(const char *query_string) #endif /* - * Currently, outfuncs/readfuncs support is missing for many raw parse - * tree nodes, so we don't try to implement WRITE_READ_PARSE_PLAN_TREES - * here. + * Optional debugging check: pass raw parsetrees through + * outfuncs/readfuncs */ +#ifdef WRITE_READ_PARSE_PLAN_TREES + { + char *str = nodeToString(raw_parsetree_list); + List *new_list = stringToNodeWithLocations(str); + + pfree(str); + /* This checks both outfuncs/readfuncs and the equal() routines... */ + if (!equal(new_list, raw_parsetree_list)) + elog(WARNING, "outfuncs/readfuncs failed to produce an equal raw parse tree"); + else + raw_parsetree_list = new_list; + } +#endif TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string); |