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_UINT64_FIELD(fldname) \
56 appendStringInfo(str, " :" CppAsString(fldname) " " UINT64_FORMAT, \
60 #define WRITE_OID_FIELD(fldname) \
61 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
64 #define WRITE_LONG_FIELD(fldname) \
65 appendStringInfo(str, " :" CppAsString(fldname) " %ld", node->fldname)
68 #define WRITE_CHAR_FIELD(fldname) \
69 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
70 outChar(str, node->fldname))
73 #define WRITE_ENUM_FIELD(fldname, enumtype) \
74 appendStringInfo(str, " :" CppAsString(fldname) " %d", \
78 #define WRITE_FLOAT_FIELD(fldname) \
79 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
80 outDouble(str, node->fldname))
83 #define WRITE_BOOL_FIELD(fldname) \
84 appendStringInfo(str, " :" CppAsString(fldname) " %s", \
85 booltostr(node->fldname))
88 #define WRITE_STRING_FIELD(fldname) \
89 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
90 outToken(str, node->fldname))
93 #define WRITE_LOCATION_FIELD(fldname) \
94 appendStringInfo(str, " :" CppAsString(fldname) " %d", write_location_fields ? node->fldname : -1)
97 #define WRITE_NODE_FIELD(fldname) \
98 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
99 outNode(str, node->fldname))
102 #define WRITE_BITMAPSET_FIELD(fldname) \
103 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
104 outBitmapset(str, node->fldname))
107 #define WRITE_NODE_ARRAY(fldname, len) \
108 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
109 writeNodeArray(str, (const Node * const *) node->fldname, len))
112 #define WRITE_ATTRNUMBER_ARRAY(fldname, len) \
113 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
114 writeAttrNumberCols(str, node->fldname, len))
117 #define WRITE_OID_ARRAY(fldname, len) \
118 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
119 writeOidCols(str, node->fldname, len))
122 #define WRITE_INDEX_ARRAY(fldname, len) \
123 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
124 writeIndexCols(str, node->fldname, len))
127 #define WRITE_INT_ARRAY(fldname, len) \
128 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
129 writeIntCols(str, node->fldname, len))
132 #define WRITE_BOOL_ARRAY(fldname, len) \
133 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
134 writeBoolCols(str, node->fldname, len))
136 #define booltostr(x) ((x) ? "true" : "false")
170 isdigit((
unsigned char) *s) ||
171 ((*s ==
'+' || *s ==
'-') &&
172 (isdigit((
unsigned char) s[1]) || s[1] ==
'.')))
177 if (*s ==
' ' || *s ==
'\n' || *s ==
'\t' ||
178 *s ==
'(' || *s ==
')' || *s ==
'{' || *s ==
'}' ||
227 #define WRITE_SCALAR_ARRAY(fnname, datatype, fmtstr, convfunc) \
229 fnname(StringInfo str, const datatype *arr, int len) \
233 appendStringInfoChar(str, '('); \
234 for (int i = 0; i < len; i++) \
235 appendStringInfo(str, fmtstr, convfunc(arr[i])); \
236 appendStringInfoChar(str, ')'); \
239 appendStringInfoString(str, "<>"); \
260 for (
int i = 0;
i <
len;
i++)
281 if (
IsA(node, IntList))
283 else if (
IsA(node, OidList))
285 else if (
IsA(node, XidList))
301 else if (
IsA(node, IntList))
303 else if (
IsA(node, OidList))
305 else if (
IsA(node, XidList))
308 elog(
ERROR,
"unrecognized list node type: %d",
351 s = (
char *) (&
value);
365 for (
i = 0;
i < length;
i++)
373 #include "outfuncs.funcs.c"
395 if (node->constisnull)
398 outDatum(
str, node->constvalue, node->constlen, node->constbyval);
641 elog(
ERROR,
"unrecognized A_Expr_Kind: %d", (
int) node->
kind);
681 if (node->
sval[0] !=
'\0')
726 else if (
IsA(obj,
List) ||
IsA(obj, IntList) ||
IsA(obj, OidList) ||
747 #include "outfuncs.switch.c"
755 elog(
WARNING,
"could not dump unrecognized node type: %d",
776 bool save_write_location_fields;
int bms_next_member(const Bitmapset *a, int prevbit)
#define Assert(condition)
#define PointerIsValid(pointer)
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)
#define IsA(nodeptr, _type_)
static void _outString(StringInfo str, const String *node)
#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)
#define WRITE_NODE_FIELD(fldname)
#define WRITE_SCALAR_ARRAY(fnname, datatype, fmtstr, convfunc)
static char * nodeToStringInternal(const void *obj, bool write_loc_fields)
#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)
#define WRITE_OID_ARRAY(fldname, len)
static void _outA_Expr(StringInfo str, const A_Expr *node)
static void _outList(StringInfo str, const List *node)
#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)
char * bmsToString(const Bitmapset *bms)
#define WRITE_STRING_FIELD(fldname)
#define WRITE_INT_FIELD(fldname)
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)
char * nodeToString(const void *obj)
static void _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
void outBitmapset(StringInfo str, const Bitmapset *bms)
char * nodeToStringWithLocations(const void *obj)
static int list_length(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
void check_stack_depth(void)
static Pointer DatumGetPointer(Datum X)
static const struct fns functions
#define DOUBLE_SHORTEST_DECIMAL_LEN
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]