PostgreSQL Source Code git master
outfuncs.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * outfuncs.c
4 * Output functions for Postgres tree nodes.
5 *
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 *
10 * IDENTIFICATION
11 * src/backend/nodes/outfuncs.c
12 *
13 *-------------------------------------------------------------------------
14 */
15#include "postgres.h"
16
17#include <ctype.h>
18
19#include "access/attnum.h"
20#include "common/shortest_dec.h"
21#include "lib/stringinfo.h"
22#include "miscadmin.h"
23#include "nodes/bitmapset.h"
24#include "nodes/nodes.h"
25#include "nodes/pg_list.h"
26#include "utils/datum.h"
27
28/* State flag that determines how nodeToStringInternal() should treat location fields */
29static bool write_location_fields = false;
30
31static void outChar(StringInfo str, char c);
32static void outDouble(StringInfo str, double d);
33
34
35/*
36 * Macros to simplify output of different kinds of fields. Use these
37 * wherever possible to reduce the chance for silly typos. Note that these
38 * hard-wire conventions about the names of the local variables in an Out
39 * routine.
40 */
41
42/* Write the label for the node type */
43#define WRITE_NODE_TYPE(nodelabel) \
44 appendStringInfoString(str, nodelabel)
45
46/* Write an integer field (anything written as ":fldname %d") */
47#define WRITE_INT_FIELD(fldname) \
48 appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
49
50/* Write an unsigned integer field (anything written as ":fldname %u") */
51#define WRITE_UINT_FIELD(fldname) \
52 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
53
54/* Write a signed integer field (anything written with INT64_FORMAT) */
55#define WRITE_INT64_FIELD(fldname) \
56 appendStringInfo(str, \
57 " :" CppAsString(fldname) " " INT64_FORMAT, \
58 node->fldname)
59
60/* Write an unsigned integer field (anything written with UINT64_FORMAT) */
61#define WRITE_UINT64_FIELD(fldname) \
62 appendStringInfo(str, " :" CppAsString(fldname) " " UINT64_FORMAT, \
63 node->fldname)
64
65/* Write an OID field (don't hard-wire assumption that OID is same as uint) */
66#define WRITE_OID_FIELD(fldname) \
67 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
68
69/* Write a long-integer field */
70#define WRITE_LONG_FIELD(fldname) \
71 appendStringInfo(str, " :" CppAsString(fldname) " %ld", node->fldname)
72
73/* Write a char field (ie, one ascii character) */
74#define WRITE_CHAR_FIELD(fldname) \
75 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
76 outChar(str, node->fldname))
77
78/* Write an enumerated-type field as an integer code */
79#define WRITE_ENUM_FIELD(fldname, enumtype) \
80 appendStringInfo(str, " :" CppAsString(fldname) " %d", \
81 (int) node->fldname)
82
83/* Write a float field (actually, they're double) */
84#define WRITE_FLOAT_FIELD(fldname) \
85 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
86 outDouble(str, node->fldname))
87
88/* Write a boolean field */
89#define WRITE_BOOL_FIELD(fldname) \
90 appendStringInfo(str, " :" CppAsString(fldname) " %s", \
91 booltostr(node->fldname))
92
93/* Write a character-string (possibly NULL) field */
94#define WRITE_STRING_FIELD(fldname) \
95 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
96 outToken(str, node->fldname))
97
98/* Write a parse location field (actually same as INT case) */
99#define WRITE_LOCATION_FIELD(fldname) \
100 appendStringInfo(str, " :" CppAsString(fldname) " %d", write_location_fields ? node->fldname : -1)
101
102/* Write a Node field */
103#define WRITE_NODE_FIELD(fldname) \
104 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
105 outNode(str, node->fldname))
106
107/* Write a bitmapset field */
108#define WRITE_BITMAPSET_FIELD(fldname) \
109 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
110 outBitmapset(str, node->fldname))
111
112/* Write a variable-length array (not a List) of Node pointers */
113#define WRITE_NODE_ARRAY(fldname, len) \
114 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
115 writeNodeArray(str, (const Node * const *) node->fldname, len))
116
117/* Write a variable-length array of AttrNumber */
118#define WRITE_ATTRNUMBER_ARRAY(fldname, len) \
119 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
120 writeAttrNumberCols(str, node->fldname, len))
121
122/* Write a variable-length array of Oid */
123#define WRITE_OID_ARRAY(fldname, len) \
124 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
125 writeOidCols(str, node->fldname, len))
126
127/* Write a variable-length array of Index */
128#define WRITE_INDEX_ARRAY(fldname, len) \
129 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
130 writeIndexCols(str, node->fldname, len))
131
132/* Write a variable-length array of int */
133#define WRITE_INT_ARRAY(fldname, len) \
134 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
135 writeIntCols(str, node->fldname, len))
136
137/* Write a variable-length array of bool */
138#define WRITE_BOOL_ARRAY(fldname, len) \
139 (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
140 writeBoolCols(str, node->fldname, len))
141
142#define booltostr(x) ((x) ? "true" : "false")
143
144
145/*
146 * outToken
147 * Convert an ordinary string (eg, an identifier) into a form that
148 * will be decoded back to a plain token by read.c's functions.
149 *
150 * If a null string pointer is given, it is encoded as '<>'.
151 * An empty string is encoded as '""'. To avoid ambiguity, input
152 * strings beginning with '<' or '"' receive a leading backslash.
153 */
154void
155outToken(StringInfo str, const char *s)
156{
157 if (s == NULL)
158 {
160 return;
161 }
162 if (*s == '\0')
163 {
165 return;
166 }
167
168 /*
169 * Look for characters or patterns that are treated specially by read.c
170 * (either in pg_strtok() or in nodeRead()), and therefore need a
171 * protective backslash.
172 */
173 /* These characters only need to be quoted at the start of the string */
174 if (*s == '<' ||
175 *s == '"' ||
176 isdigit((unsigned char) *s) ||
177 ((*s == '+' || *s == '-') &&
178 (isdigit((unsigned char) s[1]) || s[1] == '.')))
180 while (*s)
181 {
182 /* These chars must be backslashed anywhere in the string */
183 if (*s == ' ' || *s == '\n' || *s == '\t' ||
184 *s == '(' || *s == ')' || *s == '{' || *s == '}' ||
185 *s == '\\')
188 }
189}
190
191/*
192 * Convert one char. Goes through outToken() so that special characters are
193 * escaped.
194 */
195static void
197{
198 char in[2];
199
200 /* Traditionally, we've represented \0 as <>, so keep doing that */
201 if (c == '\0')
202 {
204 return;
205 }
206
207 in[0] = c;
208 in[1] = '\0';
209
210 outToken(str, in);
211}
212
213/*
214 * Convert a double value, attempting to ensure the value is preserved exactly.
215 */
216static void
218{
220
223}
224
225/*
226 * common implementation for scalar-array-writing functions
227 *
228 * The data format is either "<>" for a NULL pointer or "(item item item)".
229 * fmtstr must include a leading space, and the rest of it must produce
230 * something that will be seen as a single simple token by pg_strtok().
231 * convfunc can be empty, or the name of a conversion macro or function.
232 */
233#define WRITE_SCALAR_ARRAY(fnname, datatype, fmtstr, convfunc) \
234static void \
235fnname(StringInfo str, const datatype *arr, int len) \
236{ \
237 if (arr != NULL) \
238 { \
239 appendStringInfoChar(str, '('); \
240 for (int i = 0; i < len; i++) \
241 appendStringInfo(str, fmtstr, convfunc(arr[i])); \
242 appendStringInfoChar(str, ')'); \
243 } \
244 else \
245 appendStringInfoString(str, "<>"); \
246}
247
248WRITE_SCALAR_ARRAY(writeAttrNumberCols, AttrNumber, " %d",)
249WRITE_SCALAR_ARRAY(writeOidCols, Oid, " %u",)
250WRITE_SCALAR_ARRAY(writeIndexCols, Index, " %u",)
251WRITE_SCALAR_ARRAY(writeIntCols, int, " %d",)
252WRITE_SCALAR_ARRAY(writeBoolCols, bool, " %s", booltostr)
253
254/*
255 * Print an array (not a List) of Node pointers.
256 *
257 * The decoration is identical to that of scalar arrays, but we can't
258 * quite use appendStringInfo() in the loop.
259 */
260static void
261writeNodeArray(StringInfo str, const Node *const *arr, int len)
262{
263 if (arr != NULL)
264 {
266 for (int i = 0; i < len; i++)
267 {
269 outNode(str, arr[i]);
270 }
272 }
273 else
275}
276
277/*
278 * Print a List.
279 */
280static void
282{
283 const ListCell *lc;
284
286
287 if (IsA(node, IntList))
289 else if (IsA(node, OidList))
291 else if (IsA(node, XidList))
293
294 foreach(lc, node)
295 {
296 /*
297 * For the sake of backward compatibility, we emit a slightly
298 * different whitespace format for lists of nodes vs. other types of
299 * lists. XXX: is this necessary?
300 */
301 if (IsA(node, List))
302 {
303 outNode(str, lfirst(lc));
304 if (lnext(node, lc))
306 }
307 else if (IsA(node, IntList))
308 appendStringInfo(str, " %d", lfirst_int(lc));
309 else if (IsA(node, OidList))
310 appendStringInfo(str, " %u", lfirst_oid(lc));
311 else if (IsA(node, XidList))
312 appendStringInfo(str, " %u", lfirst_xid(lc));
313 else
314 elog(ERROR, "unrecognized list node type: %d",
315 (int) node->type);
316 }
317
319}
320
321/*
322 * outBitmapset -
323 * converts a bitmap set of integers
324 *
325 * Note: the output format is "(b int int ...)", similar to an integer List.
326 *
327 * We export this function for use by extensions that define extensible nodes.
328 * That's somewhat historical, though, because calling outNode() will work.
329 */
330void
332{
333 int x;
334
337 x = -1;
338 while ((x = bms_next_member(bms, x)) >= 0)
339 appendStringInfo(str, " %d", x);
341}
342
343/*
344 * Print the value of a Datum given its type.
345 */
346void
347outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
348{
349 Size length;
350 char *s;
351
352 length = datumGetSize(value, typbyval, typlen);
353
354 if (typbyval)
355 {
356 s = (char *) (&value);
357 appendStringInfo(str, "%u [ ", (unsigned int) length);
358 for (Size i = 0; i < (Size) sizeof(Datum); i++)
359 appendStringInfo(str, "%d ", (int) (s[i]));
361 }
362 else
363 {
364 s = (char *) DatumGetPointer(value);
365 if (!s)
366 appendStringInfoString(str, "0 [ ]");
367 else
368 {
369 appendStringInfo(str, "%u [ ", (unsigned int) length);
370 for (Size i = 0; i < length; i++)
371 appendStringInfo(str, "%d ", (int) (s[i]));
373 }
374 }
375}
376
377
378#include "outfuncs.funcs.c"
379
380
381/*
382 * Support functions for nodes with custom_read_write attribute or
383 * special_read_write attribute
384 */
385
386static void
388{
389 WRITE_NODE_TYPE("CONST");
390
391 WRITE_OID_FIELD(consttype);
392 WRITE_INT_FIELD(consttypmod);
393 WRITE_OID_FIELD(constcollid);
394 WRITE_INT_FIELD(constlen);
395 WRITE_BOOL_FIELD(constbyval);
396 WRITE_BOOL_FIELD(constisnull);
397 WRITE_LOCATION_FIELD(location);
398
399 appendStringInfoString(str, " :constvalue ");
400 if (node->constisnull)
402 else
403 outDatum(str, node->constvalue, node->constlen, node->constbyval);
404}
405
406static void
408{
409 char *opstr = NULL;
410
411 WRITE_NODE_TYPE("BOOLEXPR");
412
413 /* do-it-yourself enum representation */
414 switch (node->boolop)
415 {
416 case AND_EXPR:
417 opstr = "and";
418 break;
419 case OR_EXPR:
420 opstr = "or";
421 break;
422 case NOT_EXPR:
423 opstr = "not";
424 break;
425 }
426 appendStringInfoString(str, " :boolop ");
427 outToken(str, opstr);
428
430 WRITE_LOCATION_FIELD(location);
431}
432
433static void
435{
436 WRITE_NODE_TYPE("FOREIGNKEYOPTINFO");
437
438 WRITE_UINT_FIELD(con_relid);
439 WRITE_UINT_FIELD(ref_relid);
440 WRITE_INT_FIELD(nkeys);
441 WRITE_ATTRNUMBER_ARRAY(conkey, node->nkeys);
442 WRITE_ATTRNUMBER_ARRAY(confkey, node->nkeys);
443 WRITE_OID_ARRAY(conpfeqop, node->nkeys);
444 WRITE_INT_FIELD(nmatched_ec);
445 WRITE_INT_FIELD(nconst_ec);
446 WRITE_INT_FIELD(nmatched_rcols);
447 WRITE_INT_FIELD(nmatched_ri);
448 /* for compactness, just print the number of matches per column: */
449 appendStringInfoString(str, " :eclass");
450 for (int i = 0; i < node->nkeys; i++)
451 appendStringInfo(str, " %d", (node->eclass[i] != NULL));
452 appendStringInfoString(str, " :rinfos");
453 for (int i = 0; i < node->nkeys; i++)
454 appendStringInfo(str, " %d", list_length(node->rinfos[i]));
455}
456
457static void
459{
460 /*
461 * To simplify reading, we just chase up to the topmost merged EC and
462 * print that, without bothering to show the merge-ees separately.
463 */
464 while (node->ec_merged)
465 node = node->ec_merged;
466
467 WRITE_NODE_TYPE("EQUIVALENCECLASS");
468
469 WRITE_NODE_FIELD(ec_opfamilies);
470 WRITE_OID_FIELD(ec_collation);
471 WRITE_INT_FIELD(ec_childmembers_size);
472 WRITE_NODE_FIELD(ec_members);
473 WRITE_NODE_ARRAY(ec_childmembers, node->ec_childmembers_size);
474 WRITE_NODE_FIELD(ec_sources);
475 /* Only ec_derives_list is written; hash is not serialized. */
476 WRITE_NODE_FIELD(ec_derives_list);
477 WRITE_BITMAPSET_FIELD(ec_relids);
478 WRITE_BOOL_FIELD(ec_has_const);
479 WRITE_BOOL_FIELD(ec_has_volatile);
480 WRITE_BOOL_FIELD(ec_broken);
481 WRITE_UINT_FIELD(ec_sortref);
482 WRITE_UINT_FIELD(ec_min_security);
483 WRITE_UINT_FIELD(ec_max_security);
484}
485
486static void
488{
489 const ExtensibleNodeMethods *methods;
490
491 methods = GetExtensibleNodeMethods(node->extnodename, false);
492
493 WRITE_NODE_TYPE("EXTENSIBLENODE");
494
495 WRITE_STRING_FIELD(extnodename);
496
497 /* serialize the private fields */
498 methods->nodeOut(str, node);
499}
500
501static void
503{
504 WRITE_NODE_TYPE("RANGETBLENTRY");
505
506 WRITE_NODE_FIELD(alias);
507 WRITE_NODE_FIELD(eref);
508 WRITE_ENUM_FIELD(rtekind, RTEKind);
509
510 switch (node->rtekind)
511 {
512 case RTE_RELATION:
513 WRITE_OID_FIELD(relid);
514 WRITE_BOOL_FIELD(inh);
515 WRITE_CHAR_FIELD(relkind);
516 WRITE_INT_FIELD(rellockmode);
517 WRITE_UINT_FIELD(perminfoindex);
518 WRITE_NODE_FIELD(tablesample);
519 break;
520 case RTE_SUBQUERY:
521 WRITE_NODE_FIELD(subquery);
522 WRITE_BOOL_FIELD(security_barrier);
523 /* we re-use these RELATION fields, too: */
524 WRITE_OID_FIELD(relid);
525 WRITE_BOOL_FIELD(inh);
526 WRITE_CHAR_FIELD(relkind);
527 WRITE_INT_FIELD(rellockmode);
528 WRITE_UINT_FIELD(perminfoindex);
529 break;
530 case RTE_JOIN:
531 WRITE_ENUM_FIELD(jointype, JoinType);
532 WRITE_INT_FIELD(joinmergedcols);
533 WRITE_NODE_FIELD(joinaliasvars);
534 WRITE_NODE_FIELD(joinleftcols);
535 WRITE_NODE_FIELD(joinrightcols);
536 WRITE_NODE_FIELD(join_using_alias);
537 break;
538 case RTE_FUNCTION:
540 WRITE_BOOL_FIELD(funcordinality);
541 break;
542 case RTE_TABLEFUNC:
543 WRITE_NODE_FIELD(tablefunc);
544 break;
545 case RTE_VALUES:
546 WRITE_NODE_FIELD(values_lists);
547 WRITE_NODE_FIELD(coltypes);
548 WRITE_NODE_FIELD(coltypmods);
549 WRITE_NODE_FIELD(colcollations);
550 break;
551 case RTE_CTE:
552 WRITE_STRING_FIELD(ctename);
553 WRITE_UINT_FIELD(ctelevelsup);
554 WRITE_BOOL_FIELD(self_reference);
555 WRITE_NODE_FIELD(coltypes);
556 WRITE_NODE_FIELD(coltypmods);
557 WRITE_NODE_FIELD(colcollations);
558 break;
560 WRITE_STRING_FIELD(enrname);
561 WRITE_FLOAT_FIELD(enrtuples);
562 WRITE_NODE_FIELD(coltypes);
563 WRITE_NODE_FIELD(coltypmods);
564 WRITE_NODE_FIELD(colcollations);
565 /* we re-use these RELATION fields, too: */
566 WRITE_OID_FIELD(relid);
567 break;
568 case RTE_RESULT:
569 /* no extra fields */
570 break;
571 case RTE_GROUP:
572 WRITE_NODE_FIELD(groupexprs);
573 break;
574 default:
575 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
576 break;
577 }
578
579 WRITE_BOOL_FIELD(lateral);
580 WRITE_BOOL_FIELD(inFromCl);
581 WRITE_NODE_FIELD(securityQuals);
582}
583
584static void
586{
587 WRITE_NODE_TYPE("A_EXPR");
588
589 switch (node->kind)
590 {
591 case AEXPR_OP:
593 break;
594 case AEXPR_OP_ANY:
597 break;
598 case AEXPR_OP_ALL:
601 break;
602 case AEXPR_DISTINCT:
603 appendStringInfoString(str, " DISTINCT");
605 break;
607 appendStringInfoString(str, " NOT_DISTINCT");
609 break;
610 case AEXPR_NULLIF:
611 appendStringInfoString(str, " NULLIF");
613 break;
614 case AEXPR_IN:
617 break;
618 case AEXPR_LIKE:
619 appendStringInfoString(str, " LIKE");
621 break;
622 case AEXPR_ILIKE:
623 appendStringInfoString(str, " ILIKE");
625 break;
626 case AEXPR_SIMILAR:
627 appendStringInfoString(str, " SIMILAR");
629 break;
630 case AEXPR_BETWEEN:
631 appendStringInfoString(str, " BETWEEN");
633 break;
635 appendStringInfoString(str, " NOT_BETWEEN");
637 break;
639 appendStringInfoString(str, " BETWEEN_SYM");
641 break;
643 appendStringInfoString(str, " NOT_BETWEEN_SYM");
645 break;
646 default:
647 elog(ERROR, "unrecognized A_Expr_Kind: %d", (int) node->kind);
648 break;
649 }
650
651 WRITE_NODE_FIELD(lexpr);
652 WRITE_NODE_FIELD(rexpr);
653 WRITE_LOCATION_FIELD(rexpr_list_start);
654 WRITE_LOCATION_FIELD(rexpr_list_end);
655 WRITE_LOCATION_FIELD(location);
656}
657
658static void
660{
661 appendStringInfo(str, "%d", node->ival);
662}
663
664static void
666{
667 /*
668 * We assume the value is a valid numeric literal and so does not need
669 * quoting.
670 */
672}
673
674static void
676{
677 appendStringInfoString(str, node->boolval ? "true" : "false");
678}
679
680static void
682{
683 /*
684 * We use outToken to provide escaping of the string's content, but we
685 * don't want it to convert an empty string to '""', because we're putting
686 * double quotes around the string already.
687 */
689 if (node->sval[0] != '\0')
690 outToken(str, node->sval);
692}
693
694static void
696{
697 /*
698 * The lexer will always produce a string starting with 'b' or 'x'. There
699 * might be characters following that that need escaping, but outToken
700 * won't escape the 'b' or 'x'. This is relied on by nodeTokenType.
701 */
702 Assert(node->bsval[0] == 'b' || node->bsval[0] == 'x');
703 outToken(str, node->bsval);
704}
705
706static void
708{
709 WRITE_NODE_TYPE("A_CONST");
710
711 if (node->isnull)
712 appendStringInfoString(str, " NULL");
713 else
714 {
715 appendStringInfoString(str, " :val ");
716 outNode(str, &node->val);
717 }
718 WRITE_LOCATION_FIELD(location);
719}
720
721
722/*
723 * outNode -
724 * converts a Node into ascii string and append it to 'str'
725 */
726void
727outNode(StringInfo str, const void *obj)
728{
729 /* Guard against stack overflow due to overly complex expressions */
731
732 if (obj == NULL)
734 else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList) ||
735 IsA(obj, XidList))
736 _outList(str, obj);
737 /* nodeRead does not want to see { } around these! */
738 else if (IsA(obj, Integer))
739 _outInteger(str, (Integer *) obj);
740 else if (IsA(obj, Float))
741 _outFloat(str, (Float *) obj);
742 else if (IsA(obj, Boolean))
743 _outBoolean(str, (Boolean *) obj);
744 else if (IsA(obj, String))
745 _outString(str, (String *) obj);
746 else if (IsA(obj, BitString))
747 _outBitString(str, (BitString *) obj);
748 else if (IsA(obj, Bitmapset))
749 outBitmapset(str, (Bitmapset *) obj);
750 else
751 {
753 switch (nodeTag(obj))
754 {
755#include "outfuncs.switch.c"
756
757 default:
758
759 /*
760 * This should be an ERROR, but it's too useful to be able to
761 * dump structures that outNode only understands part of.
762 */
763 elog(WARNING, "could not dump unrecognized node type: %d",
764 (int) nodeTag(obj));
765 break;
766 }
768 }
769}
770
771/*
772 * nodeToString -
773 * returns the ascii representation of the Node as a palloc'd string
774 *
775 * write_loc_fields determines whether location fields are output with their
776 * actual value rather than -1. The actual value can be useful for debugging,
777 * but for most uses, the actual value is not useful, since the original query
778 * string is no longer available.
779 */
780static char *
781nodeToStringInternal(const void *obj, bool write_loc_fields)
782{
784 bool save_write_location_fields;
785
786 save_write_location_fields = write_location_fields;
787 write_location_fields = write_loc_fields;
788
789 /* see stringinfo.h for an explanation of this maneuver */
791 outNode(&str, obj);
792
793 write_location_fields = save_write_location_fields;
794
795 return str.data;
796}
797
798/*
799 * Externally visible entry points
800 */
801char *
802nodeToString(const void *obj)
803{
804 return nodeToStringInternal(obj, false);
805}
806
807char *
809{
810 return nodeToStringInternal(obj, true);
811}
812
813
814/*
815 * bmsToString -
816 * returns the ascii representation of the Bitmapset as a palloc'd string
817 */
818char *
820{
822
823 /* see stringinfo.h for an explanation of this maneuver */
825 outBitmapset(&str, bms);
826 return str.data;
827}
int16 AttrNumber
Definition: attnum.h:21
int bms_next_member(const Bitmapset *a, int prevbit)
Definition: bitmapset.c:1305
unsigned int Index
Definition: c.h:622
size_t Size
Definition: c.h:613
int double_to_shortest_decimal_buf(double f, char *result)
Definition: d2s.c:1053
Size datumGetSize(Datum value, bool typByVal, int typLen)
Definition: datum.c:65
#define WARNING
Definition: elog.h:36
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:226
const ExtensibleNodeMethods * GetExtensibleNodeMethods(const char *extnodename, bool missing_ok)
Definition: extensible.c:125
Assert(PointerIsAligned(start, uint64))
const char * str
static struct @171 value
int x
Definition: isn.c:75
int i
Definition: isn.c:77
#define IsA(nodeptr, _type_)
Definition: nodes.h:164
#define nodeTag(nodeptr)
Definition: nodes.h:139
JoinType
Definition: nodes.h:298
static void _outString(StringInfo str, const String *node)
Definition: outfuncs.c:681
#define WRITE_NODE_ARRAY(fldname, len)
Definition: outfuncs.c:113
#define WRITE_OID_FIELD(fldname)
Definition: outfuncs.c:66
#define WRITE_BITMAPSET_FIELD(fldname)
Definition: outfuncs.c:108
void outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
Definition: outfuncs.c:347
#define booltostr(x)
Definition: outfuncs.c:142
static void outChar(StringInfo str, char c)
Definition: outfuncs.c:196
static void _outExtensibleNode(StringInfo str, const ExtensibleNode *node)
Definition: outfuncs.c:487
static void _outA_Const(StringInfo str, const A_Const *node)
Definition: outfuncs.c:707
static void _outBoolExpr(StringInfo str, const BoolExpr *node)
Definition: outfuncs.c:407
#define WRITE_ENUM_FIELD(fldname, enumtype)
Definition: outfuncs.c:79
static void _outForeignKeyOptInfo(StringInfo str, const ForeignKeyOptInfo *node)
Definition: outfuncs.c:434
static void outDouble(StringInfo str, double d)
Definition: outfuncs.c:217
#define WRITE_ATTRNUMBER_ARRAY(fldname, len)
Definition: outfuncs.c:118
#define WRITE_FLOAT_FIELD(fldname)
Definition: outfuncs.c:84
char * nodeToStringWithLocations(const void *obj)
Definition: outfuncs.c:808
#define WRITE_NODE_FIELD(fldname)
Definition: outfuncs.c:103
#define WRITE_SCALAR_ARRAY(fnname, datatype, fmtstr, convfunc)
Definition: outfuncs.c:233
#define WRITE_NODE_TYPE(nodelabel)
Definition: outfuncs.c:43
static void _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
Definition: outfuncs.c:502
static void _outConst(StringInfo str, const Const *node)
Definition: outfuncs.c:387
#define WRITE_BOOL_FIELD(fldname)
Definition: outfuncs.c:89
void outToken(StringInfo str, const char *s)
Definition: outfuncs.c:155
static void _outInteger(StringInfo str, const Integer *node)
Definition: outfuncs.c:659
#define WRITE_UINT_FIELD(fldname)
Definition: outfuncs.c:51
char * nodeToString(const void *obj)
Definition: outfuncs.c:802
#define WRITE_OID_ARRAY(fldname, len)
Definition: outfuncs.c:123
static void _outA_Expr(StringInfo str, const A_Expr *node)
Definition: outfuncs.c:585
static void _outList(StringInfo str, const List *node)
Definition: outfuncs.c:281
char * bmsToString(const Bitmapset *bms)
Definition: outfuncs.c:819
#define WRITE_CHAR_FIELD(fldname)
Definition: outfuncs.c:74
static bool write_location_fields
Definition: outfuncs.c:29
void outNode(StringInfo str, const void *obj)
Definition: outfuncs.c:727
#define WRITE_LOCATION_FIELD(fldname)
Definition: outfuncs.c:99
static void _outFloat(StringInfo str, const Float *node)
Definition: outfuncs.c:665
#define WRITE_STRING_FIELD(fldname)
Definition: outfuncs.c:94
#define WRITE_INT_FIELD(fldname)
Definition: outfuncs.c:47
static char * nodeToStringInternal(const void *obj, bool write_loc_fields)
Definition: outfuncs.c:781
static void _outBitString(StringInfo str, const BitString *node)
Definition: outfuncs.c:695
static void _outBoolean(StringInfo str, const Boolean *node)
Definition: outfuncs.c:675
static void writeNodeArray(StringInfo str, const Node *const *arr, int len)
Definition: outfuncs.c:261
static void _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
Definition: outfuncs.c:458
void outBitmapset(StringInfo str, const Bitmapset *bms)
Definition: outfuncs.c:331
@ AEXPR_BETWEEN
Definition: parsenodes.h:340
@ AEXPR_NULLIF
Definition: parsenodes.h:335
@ AEXPR_NOT_DISTINCT
Definition: parsenodes.h:334
@ AEXPR_BETWEEN_SYM
Definition: parsenodes.h:342
@ AEXPR_NOT_BETWEEN_SYM
Definition: parsenodes.h:343
@ AEXPR_ILIKE
Definition: parsenodes.h:338
@ AEXPR_IN
Definition: parsenodes.h:336
@ AEXPR_NOT_BETWEEN
Definition: parsenodes.h:341
@ AEXPR_DISTINCT
Definition: parsenodes.h:333
@ AEXPR_SIMILAR
Definition: parsenodes.h:339
@ AEXPR_LIKE
Definition: parsenodes.h:337
@ AEXPR_OP
Definition: parsenodes.h:330
@ AEXPR_OP_ANY
Definition: parsenodes.h:331
@ AEXPR_OP_ALL
Definition: parsenodes.h:332
RTEKind
Definition: parsenodes.h:1042
@ RTE_JOIN
Definition: parsenodes.h:1045
@ RTE_CTE
Definition: parsenodes.h:1049
@ RTE_NAMEDTUPLESTORE
Definition: parsenodes.h:1050
@ RTE_VALUES
Definition: parsenodes.h:1048
@ RTE_SUBQUERY
Definition: parsenodes.h:1044
@ RTE_RESULT
Definition: parsenodes.h:1051
@ RTE_FUNCTION
Definition: parsenodes.h:1046
@ RTE_TABLEFUNC
Definition: parsenodes.h:1047
@ RTE_GROUP
Definition: parsenodes.h:1054
@ RTE_RELATION
Definition: parsenodes.h:1043
const void size_t len
#define lfirst(lc)
Definition: pg_list.h:172
static int list_length(const List *l)
Definition: pg_list.h:152
#define lfirst_int(lc)
Definition: pg_list.h:173
static ListCell * lnext(const List *l, const ListCell *c)
Definition: pg_list.h:343
#define lfirst_oid(lc)
Definition: pg_list.h:174
#define lfirst_xid(lc)
Definition: pg_list.h:175
static char * buf
Definition: pg_test_fsync.c:72
uint64_t Datum
Definition: postgres.h:70
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:322
unsigned int Oid
Definition: postgres_ext.h:32
char * c
@ AND_EXPR
Definition: primnodes.h:963
@ OR_EXPR
Definition: primnodes.h:963
@ NOT_EXPR
Definition: primnodes.h:963
static const struct fns functions
Definition: regcomp.c:358
#define DOUBLE_SHORTEST_DECIMAL_LEN
Definition: shortest_dec.h:44
void check_stack_depth(void)
Definition: stack_depth.c:95
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:145
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:230
void appendStringInfoChar(StringInfo str, char ch)
Definition: stringinfo.c:242
void initStringInfo(StringInfo str)
Definition: stringinfo.c:97
bool isnull
Definition: parsenodes.h:388
union ValUnion val
Definition: parsenodes.h:387
A_Expr_Kind kind
Definition: parsenodes.h:351
char * bsval
Definition: value.h:76
BoolExprType boolop
Definition: primnodes.h:971
Definition: value.h:56
bool boolval
Definition: value.h:60
int ec_childmembers_size
Definition: pathnodes.h:1563
struct EquivalenceClass * ec_merged
Definition: pathnodes.h:1579
void(* nodeOut)(struct StringInfoData *str, const struct ExtensibleNode *node)
Definition: extensible.h:70
const char * extnodename
Definition: extensible.h:37
Definition: value.h:48
char * fval
Definition: value.h:52
struct EquivalenceClass * eclass[INDEX_MAX_KEYS]
Definition: pathnodes.h:1398
List * rinfos[INDEX_MAX_KEYS]
Definition: pathnodes.h:1402
Definition: value.h:29
int ival
Definition: value.h:33
Definition: pg_list.h:54
NodeTag type
Definition: pg_list.h:55
Definition: nodes.h:135
RTEKind rtekind
Definition: parsenodes.h:1078
Definition: value.h:64
char * sval
Definition: value.h:68
const char * name