1 /*
2  * This file and its contents are licensed under the Apache License 2.0.
3  * Please see the included NOTICE for copyright information and
4  * LICENSE-APACHE for a copy of the license.
5  */
6 #ifndef TIMESCALEDB_DEBUG_GUC_H
7 #define TIMESCALEDB_DEBUG_GUC_H
8 
9 #include <postgres.h>
10 #include <fmgr.h>
11 #include <utils/guc.h>
12 
13 #include "export.h"
14 
15 /*
16  * Enable printout inside ts_create_upper based on the stage provided. It is
17  * possible to enable printout for multiple stages, so we take the existing
18  * stage list and create a mask from it.
19  */
20 #define STAGE_SETOP (1UL << UPPERREL_SETOP) /* Enabled using "setop" */
21 #define STAGE_PARTIAL_GROUP_AGG                                                                    \
22 	(1UL << UPPERREL_PARTIAL_GROUP_AGG)				/* Enabled using "partial_group_agg" */
23 #define STAGE_GROUP_AGG (1UL << UPPERREL_GROUP_AGG) /* Enabled using "group_agg" */
24 #define STAGE_WINDOW (1UL << UPPERREL_WINDOW)		/* Enabled using "window" */
25 #define STAGE_DISTINCT (1UL << UPPERREL_DISTINCT)   /* Enabled using "distinct" */
26 #define STAGE_ORDERED (1UL << UPPERREL_ORDERED)		/* Enabled using "ordered" */
27 #define STAGE_FINAL (1UL << UPPERREL_FINAL)			/* Enabled using "final" */
28 
29 /*
30  * Debug flags for the optimizer.
31  *
32  * Add new flags here as you see fit, but don't forget to update the flag list
33  * `flag_names` in guc.c.
34  */
35 typedef struct DebugOptimizerFlags
36 {
37 	/* Bit mask to represent set of UpperRelationKind, which is used as the
38 	 * stage inside create_upper. */
39 	unsigned long show_upper;
40 	bool show_rel;
41 } DebugOptimizerFlags;
42 
43 extern TSDLLEXPORT DebugOptimizerFlags ts_debug_optimizer_flags;
44 
45 extern void ts_debug_init(void);
46 
47 #endif /* TIMESCALEDB_DEBUG_GUC_H */
48