DISK_SIZE: 50
CCACHE_DIR: /tmp/ccache_dir
- CPPFLAGS: -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST -D ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS
+ CPPFLAGS: -DRELCACHE_FORCE_RELEASE -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS
CFLAGS: -Og -ggdb
+ PG_TEST_INITDB_EXTRA_OPTS: -c debug_copy_parse_plan_trees=on -c debug_write_read_parse_plan_trees=on -c debug_raw_expression_coverage_test=on
PG_TEST_PG_UPGRADE_MODE: --link
<<: *freebsd_task_template
+
+ debug_copy_parse_plan_trees (boolean )
+
+
debug_copy_parse_plan_trees configuration parameter
+
+
+
+ Enabling this forces all parse and plan trees to be passed through
+ copyObject() , to facilitate catching errors and
+ omissions in copyObject() . The default is off.
+
+
+ This parameter is only available when
+ DEBUG_NODE_TESTS_ENABLED was defined at compile time
+ (which happens automatically when using the
+ --enable-cassert ).
+
+
+
+
debug_discard_caches (integer )
+
+ debug_raw_expression_coverage_test (boolean )
+
+
debug_raw_expression_coverage_test configuration parameter
+
+
+
+ Enabling this forces all raw parse trees for DML statements to be
+ scanned by raw_expression_tree_walker() , to
+ facilitate catching errors and omissions in that function. The
+ default is off.
+
+
+ This parameter is only available when
+ DEBUG_NODE_TESTS_ENABLED was defined at compile time
+ (which happens automatically when using the
+ --enable-cassert ).
+
+
+
+
+
+ debug_write_read_parse_plan_trees (boolean )
+
+
debug_write_read_parse_plan_trees configuration parameter
+
+
+
+ Enabling this forces all parse and plan trees to be passed through
+ outfuncs.c /readfuncs.c , to
+ facilitate catching errors and omissions in those modules. The
+ default is off.
+
+
+ This parameter is only available when
+ DEBUG_NODE_TESTS_ENABLED was defined at compile time
+ (which happens automatically when using the
+ --enable-cassert ).
+
+
+
+
ignore_system_indexes (boolean )
node types to find all the places to touch.
(Except for frequently-created nodes, don't bother writing a creator
function in makefuncs.c.)
-4. Consider testing your new code with COPY_PARSE_PLAN_TREES,
- WRITE_READ_PARSE_PLAN_TREES, and RAW_EXPRESSION_COVERAGE_TEST to ensure
- support has been added everywhere that it's necessary; see
- pg_config_manual.h about these.
+4. Consider testing your new code with debug_copy_parse_plan_trees,
+ debug_write_read_parse_plan_trees, and
+ debug_raw_expression_coverage_test to ensure support has been added
+ everywhere that it's necessary (e.g., run the tests with
+ PG_TEST_INITDB_EXTRA_OPTS='-c debug_...=on').
Adding a new node type moves the numbers associated with existing
tags, so you'll need to recompile the whole tree after doing this.
static const char *pg_strtok_ptr = NULL;
/* State flag that determines how readfuncs.c should treat location fields */
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
bool restore_location_fields = false;
#endif
*
* restore_loc_fields instructs readfuncs.c whether to restore location
* fields rather than set them to -1. This is currently only supported
- * in builds with the WRITE_READ_PARSE_PLAN_TREES debugging flag set .
+ * in builds with DEBUG_NODE_TESTS_ENABLED defined .
*/
static void *
stringToNodeInternal(const char *str, bool restore_loc_fields)
{
void *retval;
const char *save_strtok;
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
bool save_restore_location_fields;
#endif
/*
* If enabled, likewise save/restore the location field handling flag.
*/
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
save_restore_location_fields = restore_location_fields;
restore_location_fields = restore_loc_fields;
#endif
pg_strtok_ptr = save_strtok;
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
restore_location_fields = save_restore_location_fields;
#endif
return stringToNodeInternal(str, false);
}
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
void *
stringToNodeWithLocations(const char *str)
*
* However, if restore_location_fields is true, we do restore location
* fields from the string. This is currently intended only for use by the
- * WRITE_READ_PARSE_PLAN_TREES test code, which doesn't want to cause
+ * debug_write_read_parse_plan_trees test code, which doesn't want to cause
* any change in the node contents.
*
*-------------------------------------------------------------------------
local_node->fldname = nullable_string(token, length)
/* Read a parse location field (and possibly throw away the value) */
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
#define READ_LOCATION_FIELD(fldname) \
token = pg_strtok(&length); /* skip :fldname */ \
token = pg_strtok(&length); /* get field value */ \
#include "parser/parsetree.h"
#include "utils/backend_status.h"
#include "utils/builtins.h"
+#include "utils/guc.h"
#include "utils/rel.h"
#include "utils/syscache.h"
CallStmt *stmt);
static void transformLockingClause(ParseState *pstate, Query *qry,
LockingClause *lc, bool pushedDown);
-#ifdef RAW_EXPRESSION_COVERAGE_TEST
+#ifdef DEBUG_NODE_TESTS_ENABLED
static bool test_raw_expression_coverage(Node *node, void *context);
#endif
{
Query *result;
+#ifdef DEBUG_NODE_TESTS_ENABLED
+
/*
- * We apply RAW_EXPRESSION_COVERAGE_TEST testing to basic DML statements;
- * we can't just run it on everything because raw_expression_tree_walker()
- * doesn't claim to handle utility statements.
+ * We apply debug_raw_expression_coverage_test testing to basic DML
+ * statements; we can't just run it on everything because
+ * raw_expression_tree_walker() doesn't claim to handle utility
+ * statements.
*/
-#ifdef RAW_EXPRESSION_COVERAGE_TEST
- switch (nodeTag(parseTree))
+ if (Debug_raw_expression_coverage_test)
{
- case T_SelectStmt:
- case T_InsertStmt:
- case T_UpdateStmt:
- case T_DeleteStmt:
- case T_MergeStmt:
- (void) test_raw_expression_coverage(parseTree, NULL);
- break;
- default:
- break;
+ switch (nodeTag(parseTree))
+ {
+ case T_SelectStmt:
+ case T_InsertStmt:
+ case T_UpdateStmt:
+ case T_DeleteStmt:
+ case T_MergeStmt:
+ (void) test_raw_expression_coverage(parseTree, NULL);
+ break;
+ default:
+ break;
+ }
}
-#endif /* RAW_EXPRESSION_COVERAGE_TEST */
+#endif /* DEBUG_NODE_TESTS_ENABLED */
/*
* Caution: when changing the set of statement types that have non-default
qry->rowMarks = lappend(qry->rowMarks, rc);
}
+#ifdef DEBUG_NODE_TESTS_ENABLED
/*
* Coverage testing for raw_expression_tree_walker().
*
* applied in limited cases involving CTEs, and we don't really want to have
* to test everything inside as well as outside a CTE.
*/
-#ifdef RAW_EXPRESSION_COVERAGE_TEST
-
static bool
test_raw_expression_coverage(Node *node, void *context)
{
test_raw_expression_coverage,
context);
}
-
-#endif /* RAW_EXPRESSION_COVERAGE_TEST */
+#endif /* DEBUG_NODE_TESTS_ENABLED */
if (log_parser_stats)
ShowUsage("PARSER STATISTICS");
-#ifdef COPY_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
+
/* Optional debugging check: pass raw parsetrees through copyObject() */
+ if (Debug_copy_parse_plan_trees)
{
List *new_list = copyObject(raw_parsetree_list);
else
raw_parsetree_list = new_list;
}
-#endif
/*
* Optional debugging check: pass raw parsetrees through
* outfuncs/readfuncs
*/
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+ if (Debug_write_read_parse_plan_trees)
{
char *str = nodeToStringWithLocations(raw_parsetree_list);
List *new_list = stringToNodeWithLocations(str);
else
raw_parsetree_list = new_list;
}
-#endif
+
+#endif /* DEBUG_NODE_TESTS_ENABLED */
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
if (log_parser_stats)
ShowUsage("REWRITER STATISTICS");
-#ifdef COPY_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
+
/* Optional debugging check: pass querytree through copyObject() */
+ if (Debug_copy_parse_plan_trees)
{
List *new_list;
else
querytree_list = new_list;
}
-#endif
-#ifdef WRITE_READ_PARSE_PLAN_TREES
/* Optional debugging check: pass querytree through outfuncs/readfuncs */
+ if (Debug_write_read_parse_plan_trees)
{
List *new_list = NIL;
ListCell *lc;
else
querytree_list = new_list;
}
-#endif
+
+#endif /* DEBUG_NODE_TESTS_ENABLED */
if (Debug_print_rewritten)
elog_node_display(LOG, "rewritten parse tree", querytree_list,
if (log_planner_stats)
ShowUsage("PLANNER STATISTICS");
-#ifdef COPY_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
+
/* Optional debugging check: pass plan tree through copyObject() */
+ if (Debug_copy_parse_plan_trees)
{
PlannedStmt *new_plan = copyObject(plan);
#endif
plan = new_plan;
}
-#endif
-#ifdef WRITE_READ_PARSE_PLAN_TREES
/* Optional debugging check: pass plan tree through outfuncs/readfuncs */
+ if (Debug_write_read_parse_plan_trees)
{
char *str;
PlannedStmt *new_plan;
#endif
plan = new_plan;
}
-#endif
+
+#endif /* DEBUG_NODE_TESTS_ENABLED */
/*
* Print plan if debugging.
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
+#ifdef DEBUG_NODE_TESTS_ENABLED
+bool Debug_copy_parse_plan_trees;
+bool Debug_write_read_parse_plan_trees;
+bool Debug_raw_expression_coverage_test;
+#endif
+
bool log_parser_stats = false;
bool log_planner_stats = false;
bool log_executor_stats = false;
false,
NULL, NULL, NULL
},
+#ifdef DEBUG_NODE_TESTS_ENABLED
+ {
+ {"debug_copy_parse_plan_trees", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all parse and plan trees to be passed through "
+ "copyObject(), to facilitate catching errors and omissions in "
+ "copyObject()."),
+ NULL,
+ GUC_NOT_IN_SAMPLE
+ },
+ &Debug_copy_parse_plan_trees,
+/* support for legacy compile-time setting */
+#ifdef COPY_PARSE_PLAN_TREES
+ true,
+#else
+ false,
+#endif
+ NULL, NULL, NULL
+ },
+ {
+ {"debug_write_read_parse_plan_trees", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all parse and plan trees to be passed through "
+ "outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in "
+ "those modules."),
+ NULL,
+ GUC_NOT_IN_SAMPLE
+ },
+ &Debug_write_read_parse_plan_trees,
+/* support for legacy compile-time setting */
+#ifdef WRITE_READ_PARSE_PLAN_TREES
+ true,
+#else
+ false,
+#endif
+ NULL, NULL, NULL
+ },
+ {
+ {"debug_raw_expression_coverage_test", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all raw parse trees for DML statements to be scanned "
+ "by raw_expression_tree_walker(), to facilitate catching errors and "
+ "omissions in that function."),
+ NULL,
+ GUC_NOT_IN_SAMPLE
+ },
+ &Debug_raw_expression_coverage_test,
+/* support for legacy compile-time setting */
+#ifdef RAW_EXPRESSION_COVERAGE_TEST
+ true,
+#else
+ false,
+#endif
+ NULL, NULL, NULL
+ },
+#endif /* DEBUG_NODE_TESTS_ENABLED */
{
{"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
gettext_noop("Logs each query's parse tree."),
* nodes/{readfuncs.c,read.c}
*/
extern void *stringToNode(const char *str);
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
extern void *stringToNodeWithLocations(const char *str);
#endif
extern struct Bitmapset *readBitmapset(void);
/*
* variable in read.c that needs to be accessible to readfuncs.c
*/
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
extern PGDLLIMPORT bool restore_location_fields;
#endif
/* #define RECOVER_RELATION_BUILD_MEMORY 1 */ /* Force enable */
/*
- * Define this to force all parse and plan trees to be passed through
- * copyObject(), to facilitate catching errors and omissions in
- * copyObject().
+ * Define DEBUG_NODE_TESTS_ENABLED to enable use of the GUCs
+ * debug_copy_parse_plan_trees, debug_write_read_parse_plan_trees, and
+ * debug_raw_expression_coverage_test, to test coverage of node support
+ * functions in src/backend/nodes/.
+ *
+ * USE_ASSERT_CHECKING builds default to enabling this.
*/
-/* #define COPY_PARSE_PLAN_TREES */
+/* #define DEBUG_NODE_TESTS_ENABLED */
-/*
- * Define this to force Bitmapset reallocation on each modification. Helps
- * to find dangling pointers to Bitmapset's.
- */
-/* #define REALLOCATE_BITMAPSETS */
+#if defined(USE_ASSERT_CHECKING) && !defined(DEBUG_NODE_TESTS_ENABLED)
+#define DEBUG_NODE_TESTS_ENABLED
+#endif
/*
- * Define this to force all parse and plan trees to be passed through
- * outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in
- * those modules.
+ * Backwards compatibility for the older compile-time-only node-tests macros.
*/
-/* #define WRITE_READ_PARSE_PLAN_TREES */
+#if !defined(DEBUG_NODE_TESTS_ENABLED) && (defined(COPY_PARSE_PLAN_TREES) || defined(WRITE_READ_PARSE_PLAN_TREES) || defined(RAW_EXPRESSION_COVERAGE_TEST))
+#define DEBUG_NODE_TESTS_ENABLED
+#endif
/*
- * Define this to force all raw parse trees for DML statements to be scanned
- * by raw_expression_tree_walker(), to facilitate catching errors and
- * omissions in that function.
+ * Define this to force Bitmapset reallocation on each modification. Helps
+ * to find dangling pointers to Bitmapset's.
*/
-/* #define RAW_EXPRESSION_COVERAGE_TEST */
+/* #define REALLOCATE_BITMAPSETS */
/*
* Enable debugging print statements for lock-related operations.
extern PGDLLIMPORT bool Debug_print_rewritten;
extern PGDLLIMPORT bool Debug_pretty_print;
+#ifdef DEBUG_NODE_TESTS_ENABLED
+extern PGDLLIMPORT bool Debug_copy_parse_plan_trees;
+extern PGDLLIMPORT bool Debug_write_read_parse_plan_trees;
+extern PGDLLIMPORT bool Debug_raw_expression_coverage_test;
+#endif
+
extern PGDLLIMPORT bool log_parser_stats;
extern PGDLLIMPORT bool log_planner_stats;
extern PGDLLIMPORT bool log_executor_stats;