postgresql/src/include/nodes
Tom Lane d0cfc3d6a4 Add a debugging option to stress-test outfuncs.c and readfuncs.c.
In the normal course of operation, query trees will be serialized only if
they are stored as views or rules; and plan trees will be serialized only
if they get passed to parallel-query workers.  This leaves an awful lot of
opportunity for bugs/oversights to not get detected, as indeed we've just
been reminded of the hard way.

To improve matters, this patch adds a new compile option
WRITE_READ_PARSE_PLAN_TREES, which is modeled on the longstanding option
COPY_PARSE_PLAN_TREES; but instead of passing all parse and plan trees
through copyObject, it passes them through nodeToString + stringToNode.
Enabling this option in a buildfarm animal or two will catch problems
at least for cases that are exercised by the regression tests.

A small problem with this idea is that readfuncs.c historically has
discarded location fields, on the reasonable grounds that parse
locations in a retrieved view are not relevant to the current query.
But doing that in WRITE_READ_PARSE_PLAN_TREES breaks pg_stat_statements,
and it could cause problems for future improvements that might try to
report error locations at runtime.  To fix that, provide a variant
behavior in readfuncs.c that makes it restore location fields when
told to.

In passing, const-ify the string arguments of stringToNode and its
subsidiary functions, just because it annoyed me that they weren't
const already.

Discussion: https://postgr.es/m/17114.1537138992@sss.pgh.pa.us
2018-09-18 17:11:54 -04:00
..
bitmapset.h Add bms_prev_member function 2018-04-07 17:54:39 -03:00
execnodes.h Fix parsetree representation of XMLTABLE(XMLNAMESPACES(DEFAULT ...)). 2018-09-17 13:16:32 -04:00
extensible.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
lockoptions.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
makefuncs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
memnodes.h Allow memory contexts to have both fixed and variable ident strings. 2018-03-27 16:46:51 -04:00
nodeFuncs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes.h Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
params.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
parsenodes.h Fix some minor issues exposed by outfuncs/readfuncs testing. 2018-09-18 15:08:28 -04:00
pg_list.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
plannodes.h Fix run-time partition pruning for appends with multiple source rels. 2018-08-01 19:42:52 -04:00
primnodes.h Fix parsetree representation of XMLTABLE(XMLNAMESPACES(DEFAULT ...)). 2018-09-17 13:16:32 -04:00
print.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
readfuncs.h Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
relation.h Disable support for partitionwise joins in problematic cases. 2018-08-31 20:34:06 +09:00
replnodes.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tidbitmap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
value.h Change internal integer representation of Value node 2018-03-13 09:56:25 -04:00