postgresql/src/backend
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
..
access Attach FPI to the first record after full_page_writes is turned on. 2018-09-13 15:32:50 +05:30
bootstrap Install a check for mis-linking of src/port and src/common functions. 2018-09-09 12:23:23 -04:00
catalog Refactor routines for subscription and publication lookups 2018-09-18 12:00:18 +09:00
commands Fix ALTER/TYPE on columns referenced by FKs in partitioned tables 2018-09-14 13:41:20 -03:00
executor Fix parsetree representation of XMLTABLE(XMLNAMESPACES(DEFAULT ...)). 2018-09-17 13:16:32 -04:00
foreign Remove bogus "extern" annotations on function definitions. 2018-02-19 12:07:44 -05:00
jit In v11, disable JIT by default (it's still enabled by default in HEAD). 2018-09-15 17:24:35 -04:00
lib doc: Update redirecting links 2018-07-16 10:48:05 +02:00
libpq Minor cleanup/future-proofing for pg_saslprep(). 2018-09-08 18:20:36 -04:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
optimizer Fix some minor issues exposed by outfuncs/readfuncs testing. 2018-09-18 15:08:28 -04:00
parser Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
partitioning Remove duplicated words split across lines in comments 2018-09-08 12:24:19 -07:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Refactor dlopen() support 2018-09-06 11:33:04 +02:00
postmaster Refactor dlopen() support 2018-09-06 11:33:04 +02:00
regex Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
replication Improve some error message strings and errcodes 2018-09-04 11:06:04 -07:00
rewrite Fix some minor issues exposed by outfuncs/readfuncs testing. 2018-09-18 15:08:28 -04:00
snowball Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
statistics Fix typos. 2018-08-27 09:32:59 +12:00
storage Allow DSM allocation to be interrupted. 2018-09-18 22:56:36 +12:00
tcop Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
tsearch Hand code string to integer conversion for performance. 2018-07-22 14:58:23 -07:00
utils Fix parsetree representation of XMLTABLE(XMLNAMESPACES(DEFAULT ...)). 2018-09-17 13:16:32 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Refactor dlopen() support 2018-09-06 11:33:04 +02:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00