43#define WRITE_NODE_TYPE(nodelabel) \
44 appendStringInfoString(str, nodelabel)
47#define WRITE_INT_FIELD(fldname) \
48 appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
51#define WRITE_UINT_FIELD(fldname) \
52 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
55#define WRITE_INT64_FIELD(fldname) \
56 appendStringInfo(str, \
57 " :" CppAsString(fldname) " " INT64_FORMAT, \
61#define WRITE_UINT64_FIELD(fldname) \
62 appendStringInfo(str, " :" CppAsString(fldname) " " UINT64_FORMAT, \
66#define WRITE_OID_FIELD(fldname) \
67 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
70#define WRITE_LONG_FIELD(fldname) \
71 appendStringInfo(str, " :" CppAsString(fldname) " %ld", node->fldname)
74#define WRITE_CHAR_FIELD(fldname) \
75 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
76 outChar(str, node->fldname))
79#define WRITE_ENUM_FIELD(fldname, enumtype) \
80 appendStringInfo(str, " :" CppAsString(fldname) " %d", \
84#define WRITE_FLOAT_FIELD(fldname) \
85 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
86 outDouble(str, node->fldname))
89#define WRITE_BOOL_FIELD(fldname) \
90 appendStringInfo(str, " :" CppAsString(fldname) " %s", \
91 booltostr(node->fldname))
94#define WRITE_STRING_FIELD(fldname) \
95 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
96 outToken(str, node->fldname))
99#define WRITE_LOCATION_FIELD(fldname) \
100 appendStringInfo(str, " :" CppAsString(fldname) " %d", write_location_fields ? node->fldname : -1)
103#define WRITE_NODE_FIELD(fldname) \
104 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
105 outNode(str, node->fldname))
108#define WRITE_BITMAPSET_FIELD(fldname) \
109 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
110 outBitmapset(str, node->fldname))
113#define WRITE_NODE_ARRAY(fldname, len) \
114 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
115 writeNodeArray(str, (const Node * const *) node->fldname, len))
118#define WRITE_ATTRNUMBER_ARRAY(fldname, len) \
119 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
120 writeAttrNumberCols(str, node->fldname, len))
123#define WRITE_OID_ARRAY(fldname, len) \
124 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
125 writeOidCols(str, node->fldname, len))
128#define WRITE_INDEX_ARRAY(fldname, len) \
129 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
130 writeIndexCols(str, node->fldname, len))
133#define WRITE_INT_ARRAY(fldname, len) \
134 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
135 writeIntCols(str, node->fldname, len))
138#define WRITE_BOOL_ARRAY(fldname, len) \
139 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
140 writeBoolCols(str, node->fldname, len))
142#define booltostr(x) ((x) ? "true" : "false")
176 isdigit((
unsigned char) *s) ||
177 ((*s ==
'+' || *s ==
'-') &&
178 (isdigit((
unsigned char) s[1]) || s[1] ==
'.')))
183 if (*s ==
' ' || *s ==
'\n' || *s ==
'\t' ||
184 *s ==
'(' || *s ==
')' || *s ==
'{' || *s ==
'}' ||
233#define WRITE_SCALAR_ARRAY(fnname, datatype, fmtstr, convfunc) \
235fnname(StringInfo str, const datatype *arr, int len) \
239 appendStringInfoChar(str, '('); \
240 for (int i = 0; i < len; i++) \
241 appendStringInfo(str, fmtstr, convfunc(arr[i])); \
242 appendStringInfoChar(str, ')'); \
245 appendStringInfoString(str, "<>"); \
266 for (
int i = 0;
i <
len;
i++)
287 if (
IsA(node, IntList))
289 else if (
IsA(node, OidList))
291 else if (
IsA(node, XidList))
307 else if (
IsA(node, IntList))
309 else if (
IsA(node, OidList))
311 else if (
IsA(node, XidList))
314 elog(
ERROR,
"unrecognized list node type: %d",
357 s = (
char *) (&
value);
371 for (
i = 0;
i < length;
i++)
379#include "outfuncs.funcs.c"
401 if (node->constisnull)
404 outDatum(
str, node->constvalue, node->constlen, node->constbyval);
650 elog(
ERROR,
"unrecognized A_Expr_Kind: %d", (
int) node->
kind);
692 if (node->
sval[0] !=
'\0')
737 else if (
IsA(obj,
List) ||
IsA(obj, IntList) ||
IsA(obj, OidList) ||
758#include "outfuncs.switch.c"
766 elog(
WARNING,
"could not dump unrecognized node type: %d",
787 bool save_write_location_fields;
int bms_next_member(const Bitmapset *a, int prevbit)
int double_to_shortest_decimal_buf(double f, char *result)
Size datumGetSize(Datum value, bool typByVal, int typLen)
const ExtensibleNodeMethods * GetExtensibleNodeMethods(const char *extnodename, bool missing_ok)
Assert(PointerIsAligned(start, uint64))
#define IsA(nodeptr, _type_)
static void _outString(StringInfo str, const String *node)
#define WRITE_NODE_ARRAY(fldname, len)
#define WRITE_OID_FIELD(fldname)
#define WRITE_BITMAPSET_FIELD(fldname)
void outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
static void outChar(StringInfo str, char c)
static void _outExtensibleNode(StringInfo str, const ExtensibleNode *node)
static void _outA_Const(StringInfo str, const A_Const *node)
static void _outBoolExpr(StringInfo str, const BoolExpr *node)
#define WRITE_ENUM_FIELD(fldname, enumtype)
static void _outForeignKeyOptInfo(StringInfo str, const ForeignKeyOptInfo *node)
static void outDouble(StringInfo str, double d)
#define WRITE_ATTRNUMBER_ARRAY(fldname, len)
#define WRITE_FLOAT_FIELD(fldname)
char * nodeToStringWithLocations(const void *obj)
#define WRITE_NODE_FIELD(fldname)
#define WRITE_SCALAR_ARRAY(fnname, datatype, fmtstr, convfunc)
#define WRITE_NODE_TYPE(nodelabel)
static void _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
static void _outConst(StringInfo str, const Const *node)
#define WRITE_BOOL_FIELD(fldname)
void outToken(StringInfo str, const char *s)
static void _outInteger(StringInfo str, const Integer *node)
#define WRITE_UINT_FIELD(fldname)
char * nodeToString(const void *obj)
#define WRITE_OID_ARRAY(fldname, len)
static void _outA_Expr(StringInfo str, const A_Expr *node)
static void _outList(StringInfo str, const List *node)
char * bmsToString(const Bitmapset *bms)
#define WRITE_CHAR_FIELD(fldname)
static bool write_location_fields
void outNode(StringInfo str, const void *obj)
#define WRITE_LOCATION_FIELD(fldname)
static void _outFloat(StringInfo str, const Float *node)
#define WRITE_STRING_FIELD(fldname)
#define WRITE_INT_FIELD(fldname)
static char * nodeToStringInternal(const void *obj, bool write_loc_fields)
static void _outBitString(StringInfo str, const BitString *node)
static void _outBoolean(StringInfo str, const Boolean *node)
static void writeNodeArray(StringInfo str, const Node *const *arr, int len)
static void _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
void outBitmapset(StringInfo str, const Bitmapset *bms)
static int list_length(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
static Pointer DatumGetPointer(Datum X)
static const struct fns functions
#define DOUBLE_SHORTEST_DECIMAL_LEN
void check_stack_depth(void)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
struct EquivalenceClass * ec_merged
void(* nodeOut)(struct StringInfoData *str, const struct ExtensibleNode *node)
struct EquivalenceClass * eclass[INDEX_MAX_KEYS]
List * rinfos[INDEX_MAX_KEYS]