PostgreSQL Source Code  git master
readfuncs.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * readfuncs.c
4  * Reader functions for Postgres tree nodes.
5  *
6  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/nodes/readfuncs.c
12  *
13  * NOTES
14  * Path nodes do not have any readfuncs support, because we never
15  * have occasion to read them in. (There was once code here that
16  * claimed to read them, but it was broken as well as unused.) We
17  * never read executor state trees, either.
18  *
19  * Parse location fields are written out by outfuncs.c, but only for
20  * debugging use. When reading a location field, we normally discard
21  * the stored value and set the location field to -1 (ie, "unknown").
22  * This is because nodes coming from a stored rule should not be thought
23  * to have a known location in the current query's text.
24  * However, if restore_location_fields is true, we do restore location
25  * fields from the string. This is currently intended only for use by the
26  * WRITE_READ_PARSE_PLAN_TREES test code, which doesn't want to cause
27  * any change in the node contents.
28  *
29  *-------------------------------------------------------------------------
30  */
31 #include "postgres.h"
32 
33 #include <math.h>
34 
35 #include "fmgr.h"
36 #include "miscadmin.h"
37 #include "nodes/extensible.h"
38 #include "nodes/parsenodes.h"
39 #include "nodes/plannodes.h"
40 #include "nodes/readfuncs.h"
41 #include "utils/builtins.h"
42 
43 
44 /*
45  * Macros to simplify reading of different kinds of fields. Use these
46  * wherever possible to reduce the chance for silly typos. Note that these
47  * hard-wire conventions about the names of the local variables in a Read
48  * routine.
49  */
50 
51 /* Macros for declaring appropriate local variables */
52 
53 /* A few guys need only local_node */
54 #define READ_LOCALS_NO_FIELDS(nodeTypeName) \
55  nodeTypeName *local_node = makeNode(nodeTypeName)
56 
57 /* And a few guys need only the pg_strtok support fields */
58 #define READ_TEMP_LOCALS() \
59  const char *token; \
60  int length
61 
62 /* ... but most need both */
63 #define READ_LOCALS(nodeTypeName) \
64  READ_LOCALS_NO_FIELDS(nodeTypeName); \
65  READ_TEMP_LOCALS()
66 
67 /* Read an integer field (anything written as ":fldname %d") */
68 #define READ_INT_FIELD(fldname) \
69  token = pg_strtok(&length); /* skip :fldname */ \
70  token = pg_strtok(&length); /* get field value */ \
71  local_node->fldname = atoi(token)
72 
73 /* Read an unsigned integer field (anything written as ":fldname %u") */
74 #define READ_UINT_FIELD(fldname) \
75  token = pg_strtok(&length); /* skip :fldname */ \
76  token = pg_strtok(&length); /* get field value */ \
77  local_node->fldname = atoui(token)
78 
79 /* Read an unsigned integer field (anything written using UINT64_FORMAT) */
80 #define READ_UINT64_FIELD(fldname) \
81  token = pg_strtok(&length); /* skip :fldname */ \
82  token = pg_strtok(&length); /* get field value */ \
83  local_node->fldname = pg_strtouint64(token, NULL, 10)
84 
85 /* Read a long integer field (anything written as ":fldname %ld") */
86 #define READ_LONG_FIELD(fldname) \
87  token = pg_strtok(&length); /* skip :fldname */ \
88  token = pg_strtok(&length); /* get field value */ \
89  local_node->fldname = atol(token)
90 
91 /* Read an OID field (don't hard-wire assumption that OID is same as uint) */
92 #define READ_OID_FIELD(fldname) \
93  token = pg_strtok(&length); /* skip :fldname */ \
94  token = pg_strtok(&length); /* get field value */ \
95  local_node->fldname = atooid(token)
96 
97 /* Read a char field (ie, one ascii character) */
98 #define READ_CHAR_FIELD(fldname) \
99  token = pg_strtok(&length); /* skip :fldname */ \
100  token = pg_strtok(&length); /* get field value */ \
101  /* avoid overhead of calling debackslash() for one char */ \
102  local_node->fldname = (length == 0) ? '\0' : (token[0] == '\\' ? token[1] : token[0])
103 
104 /* Read an enumerated-type field that was written as an integer code */
105 #define READ_ENUM_FIELD(fldname, enumtype) \
106  token = pg_strtok(&length); /* skip :fldname */ \
107  token = pg_strtok(&length); /* get field value */ \
108  local_node->fldname = (enumtype) atoi(token)
109 
110 /* Read a float field */
111 #define READ_FLOAT_FIELD(fldname) \
112  token = pg_strtok(&length); /* skip :fldname */ \
113  token = pg_strtok(&length); /* get field value */ \
114  local_node->fldname = atof(token)
115 
116 /* Read a boolean field */
117 #define READ_BOOL_FIELD(fldname) \
118  token = pg_strtok(&length); /* skip :fldname */ \
119  token = pg_strtok(&length); /* get field value */ \
120  local_node->fldname = strtobool(token)
121 
122 /* Read a character-string field */
123 #define READ_STRING_FIELD(fldname) \
124  token = pg_strtok(&length); /* skip :fldname */ \
125  token = pg_strtok(&length); /* get field value */ \
126  local_node->fldname = nullable_string(token, length)
127 
128 /* Read a parse location field (and possibly throw away the value) */
129 #ifdef WRITE_READ_PARSE_PLAN_TREES
130 #define READ_LOCATION_FIELD(fldname) \
131  token = pg_strtok(&length); /* skip :fldname */ \
132  token = pg_strtok(&length); /* get field value */ \
133  local_node->fldname = restore_location_fields ? atoi(token) : -1
134 #else
135 #define READ_LOCATION_FIELD(fldname) \
136  token = pg_strtok(&length); /* skip :fldname */ \
137  token = pg_strtok(&length); /* get field value */ \
138  (void) token; /* in case not used elsewhere */ \
139  local_node->fldname = -1 /* set field to "unknown" */
140 #endif
141 
142 /* Read a Node field */
143 #define READ_NODE_FIELD(fldname) \
144  token = pg_strtok(&length); /* skip :fldname */ \
145  (void) token; /* in case not used elsewhere */ \
146  local_node->fldname = nodeRead(NULL, 0)
147 
148 /* Read a bitmapset field */
149 #define READ_BITMAPSET_FIELD(fldname) \
150  token = pg_strtok(&length); /* skip :fldname */ \
151  (void) token; /* in case not used elsewhere */ \
152  local_node->fldname = _readBitmapset()
153 
154 /* Read an attribute number array */
155 #define READ_ATTRNUMBER_ARRAY(fldname, len) \
156  token = pg_strtok(&length); /* skip :fldname */ \
157  local_node->fldname = readAttrNumberCols(len)
158 
159 /* Read an oid array */
160 #define READ_OID_ARRAY(fldname, len) \
161  token = pg_strtok(&length); /* skip :fldname */ \
162  local_node->fldname = readOidCols(len)
163 
164 /* Read an int array */
165 #define READ_INT_ARRAY(fldname, len) \
166  token = pg_strtok(&length); /* skip :fldname */ \
167  local_node->fldname = readIntCols(len)
168 
169 /* Read a bool array */
170 #define READ_BOOL_ARRAY(fldname, len) \
171  token = pg_strtok(&length); /* skip :fldname */ \
172  local_node->fldname = readBoolCols(len)
173 
174 /* Routine exit */
175 #define READ_DONE() \
176  return local_node
177 
178 
179 /*
180  * NOTE: use atoi() to read values written with %d, or atoui() to read
181  * values written with %u in outfuncs.c. An exception is OID values,
182  * for which use atooid(). (As of 7.1, outfuncs.c writes OIDs as %u,
183  * but this will probably change in the future.)
184  */
185 #define atoui(x) ((unsigned int) strtoul((x), NULL, 10))
186 
187 #define strtobool(x) ((*(x) == 't') ? true : false)
188 
189 #define nullable_string(token,length) \
190  ((length) == 0 ? NULL : debackslash(token, length))
191 
192 
193 /*
194  * _readBitmapset
195  */
196 static Bitmapset *
198 {
199  Bitmapset *result = NULL;
200 
202 
203  token = pg_strtok(&length);
204  if (token == NULL)
205  elog(ERROR, "incomplete Bitmapset structure");
206  if (length != 1 || token[0] != '(')
207  elog(ERROR, "unrecognized token: \"%.*s\"", length, token);
208 
209  token = pg_strtok(&length);
210  if (token == NULL)
211  elog(ERROR, "incomplete Bitmapset structure");
212  if (length != 1 || token[0] != 'b')
213  elog(ERROR, "unrecognized token: \"%.*s\"", length, token);
214 
215  for (;;)
216  {
217  int val;
218  char *endptr;
219 
220  token = pg_strtok(&length);
221  if (token == NULL)
222  elog(ERROR, "unterminated Bitmapset structure");
223  if (length == 1 && token[0] == ')')
224  break;
225  val = (int) strtol(token, &endptr, 10);
226  if (endptr != token + length)
227  elog(ERROR, "unrecognized integer: \"%.*s\"", length, token);
228  result = bms_add_member(result, val);
229  }
230 
231  return result;
232 }
233 
234 /*
235  * for use by extensions which define extensible nodes
236  */
237 Bitmapset *
239 {
240  return _readBitmapset();
241 }
242 
243 /*
244  * _readQuery
245  */
246 static Query *
248 {
250 
251  READ_ENUM_FIELD(commandType, CmdType);
252  READ_ENUM_FIELD(querySource, QuerySource);
253  local_node->queryId = UINT64CONST(0); /* not saved in output format */
254  READ_BOOL_FIELD(canSetTag);
255  READ_NODE_FIELD(utilityStmt);
256  READ_INT_FIELD(resultRelation);
257  READ_BOOL_FIELD(hasAggs);
258  READ_BOOL_FIELD(hasWindowFuncs);
259  READ_BOOL_FIELD(hasTargetSRFs);
260  READ_BOOL_FIELD(hasSubLinks);
261  READ_BOOL_FIELD(hasDistinctOn);
262  READ_BOOL_FIELD(hasRecursive);
263  READ_BOOL_FIELD(hasModifyingCTE);
264  READ_BOOL_FIELD(hasForUpdate);
265  READ_BOOL_FIELD(hasRowSecurity);
266  READ_BOOL_FIELD(isReturn);
267  READ_NODE_FIELD(cteList);
268  READ_NODE_FIELD(rtable);
269  READ_NODE_FIELD(jointree);
270  READ_NODE_FIELD(targetList);
271  READ_ENUM_FIELD(override, OverridingKind);
272  READ_NODE_FIELD(onConflict);
273  READ_NODE_FIELD(returningList);
274  READ_NODE_FIELD(groupClause);
275  READ_BOOL_FIELD(groupDistinct);
276  READ_NODE_FIELD(groupingSets);
277  READ_NODE_FIELD(havingQual);
278  READ_NODE_FIELD(windowClause);
279  READ_NODE_FIELD(distinctClause);
280  READ_NODE_FIELD(sortClause);
281  READ_NODE_FIELD(limitOffset);
282  READ_NODE_FIELD(limitCount);
283  READ_ENUM_FIELD(limitOption, LimitOption);
284  READ_NODE_FIELD(rowMarks);
285  READ_NODE_FIELD(setOperations);
286  READ_NODE_FIELD(constraintDeps);
287  READ_NODE_FIELD(withCheckOptions);
288  READ_LOCATION_FIELD(stmt_location);
289  READ_INT_FIELD(stmt_len);
290 
291  READ_DONE();
292 }
293 
294 /*
295  * _readNotifyStmt
296  */
297 static NotifyStmt *
299 {
301 
302  READ_STRING_FIELD(conditionname);
303  READ_STRING_FIELD(payload);
304 
305  READ_DONE();
306 }
307 
308 /*
309  * _readDeclareCursorStmt
310  */
311 static DeclareCursorStmt *
313 {
315 
316  READ_STRING_FIELD(portalname);
318  READ_NODE_FIELD(query);
319 
320  READ_DONE();
321 }
322 
323 /*
324  * _readWithCheckOption
325  */
326 static WithCheckOption *
328 {
330 
331  READ_ENUM_FIELD(kind, WCOKind);
333  READ_STRING_FIELD(polname);
334  READ_NODE_FIELD(qual);
335  READ_BOOL_FIELD(cascaded);
336 
337  READ_DONE();
338 }
339 
340 /*
341  * _readSortGroupClause
342  */
343 static SortGroupClause *
345 {
347 
348  READ_UINT_FIELD(tleSortGroupRef);
349  READ_OID_FIELD(eqop);
350  READ_OID_FIELD(sortop);
351  READ_BOOL_FIELD(nulls_first);
352  READ_BOOL_FIELD(hashable);
353 
354  READ_DONE();
355 }
356 
357 /*
358  * _readGroupingSet
359  */
360 static GroupingSet *
362 {
364 
366  READ_NODE_FIELD(content);
367  READ_LOCATION_FIELD(location);
368 
369  READ_DONE();
370 }
371 
372 /*
373  * _readWindowClause
374  */
375 static WindowClause *
377 {
379 
381  READ_STRING_FIELD(refname);
382  READ_NODE_FIELD(partitionClause);
383  READ_NODE_FIELD(orderClause);
384  READ_INT_FIELD(frameOptions);
385  READ_NODE_FIELD(startOffset);
386  READ_NODE_FIELD(endOffset);
387  READ_OID_FIELD(startInRangeFunc);
388  READ_OID_FIELD(endInRangeFunc);
389  READ_OID_FIELD(inRangeColl);
390  READ_BOOL_FIELD(inRangeAsc);
391  READ_BOOL_FIELD(inRangeNullsFirst);
392  READ_UINT_FIELD(winref);
393  READ_BOOL_FIELD(copiedOrder);
394 
395  READ_DONE();
396 }
397 
398 /*
399  * _readRowMarkClause
400  */
401 static RowMarkClause *
403 {
405 
406  READ_UINT_FIELD(rti);
408  READ_ENUM_FIELD(waitPolicy, LockWaitPolicy);
409  READ_BOOL_FIELD(pushedDown);
410 
411  READ_DONE();
412 }
413 
414 /*
415  * _readCTESearchClause
416  */
417 static CTESearchClause *
419 {
421 
422  READ_NODE_FIELD(search_col_list);
423  READ_BOOL_FIELD(search_breadth_first);
424  READ_STRING_FIELD(search_seq_column);
425  READ_LOCATION_FIELD(location);
426 
427  READ_DONE();
428 }
429 
430 /*
431  * _readCTECycleClause
432  */
433 static CTECycleClause *
435 {
437 
438  READ_NODE_FIELD(cycle_col_list);
439  READ_STRING_FIELD(cycle_mark_column);
440  READ_NODE_FIELD(cycle_mark_value);
441  READ_NODE_FIELD(cycle_mark_default);
442  READ_STRING_FIELD(cycle_path_column);
443  READ_LOCATION_FIELD(location);
444  READ_OID_FIELD(cycle_mark_type);
445  READ_INT_FIELD(cycle_mark_typmod);
446  READ_OID_FIELD(cycle_mark_collation);
447  READ_OID_FIELD(cycle_mark_neop);
448 
449  READ_DONE();
450 }
451 
452 /*
453  * _readCommonTableExpr
454  */
455 static CommonTableExpr *
457 {
459 
460  READ_STRING_FIELD(ctename);
461  READ_NODE_FIELD(aliascolnames);
462  READ_ENUM_FIELD(ctematerialized, CTEMaterialize);
463  READ_NODE_FIELD(ctequery);
464  READ_NODE_FIELD(search_clause);
465  READ_NODE_FIELD(cycle_clause);
466  READ_LOCATION_FIELD(location);
467  READ_BOOL_FIELD(cterecursive);
468  READ_INT_FIELD(cterefcount);
469  READ_NODE_FIELD(ctecolnames);
470  READ_NODE_FIELD(ctecoltypes);
471  READ_NODE_FIELD(ctecoltypmods);
472  READ_NODE_FIELD(ctecolcollations);
473 
474  READ_DONE();
475 }
476 
477 /*
478  * _readSetOperationStmt
479  */
480 static SetOperationStmt *
482 {
484 
486  READ_BOOL_FIELD(all);
487  READ_NODE_FIELD(larg);
488  READ_NODE_FIELD(rarg);
489  READ_NODE_FIELD(colTypes);
490  READ_NODE_FIELD(colTypmods);
491  READ_NODE_FIELD(colCollations);
492  READ_NODE_FIELD(groupClauses);
493 
494  READ_DONE();
495 }
496 
497 
498 /*
499  * Stuff from primnodes.h.
500  */
501 
502 static Alias *
504 {
506 
507  READ_STRING_FIELD(aliasname);
508  READ_NODE_FIELD(colnames);
509 
510  READ_DONE();
511 }
512 
513 static RangeVar *
515 {
517 
518  local_node->catalogname = NULL; /* not currently saved in output format */
519 
520  READ_STRING_FIELD(schemaname);
522  READ_BOOL_FIELD(inh);
523  READ_CHAR_FIELD(relpersistence);
524  READ_NODE_FIELD(alias);
525  READ_LOCATION_FIELD(location);
526 
527  READ_DONE();
528 }
529 
530 /*
531  * _readTableFunc
532  */
533 static TableFunc *
535 {
537 
538  READ_NODE_FIELD(ns_uris);
539  READ_NODE_FIELD(ns_names);
540  READ_NODE_FIELD(docexpr);
541  READ_NODE_FIELD(rowexpr);
542  READ_NODE_FIELD(colnames);
543  READ_NODE_FIELD(coltypes);
544  READ_NODE_FIELD(coltypmods);
545  READ_NODE_FIELD(colcollations);
546  READ_NODE_FIELD(colexprs);
547  READ_NODE_FIELD(coldefexprs);
548  READ_BITMAPSET_FIELD(notnulls);
549  READ_INT_FIELD(ordinalitycol);
550  READ_LOCATION_FIELD(location);
551 
552  READ_DONE();
553 }
554 
555 static IntoClause *
557 {
559 
560  READ_NODE_FIELD(rel);
561  READ_NODE_FIELD(colNames);
562  READ_STRING_FIELD(accessMethod);
564  READ_ENUM_FIELD(onCommit, OnCommitAction);
565  READ_STRING_FIELD(tableSpaceName);
566  READ_NODE_FIELD(viewQuery);
567  READ_BOOL_FIELD(skipData);
568 
569  READ_DONE();
570 }
571 
572 /*
573  * _readVar
574  */
575 static Var *
576 _readVar(void)
577 {
578  READ_LOCALS(Var);
579 
580  READ_UINT_FIELD(varno);
581  READ_INT_FIELD(varattno);
582  READ_OID_FIELD(vartype);
583  READ_INT_FIELD(vartypmod);
584  READ_OID_FIELD(varcollid);
585  READ_UINT_FIELD(varlevelsup);
586  READ_UINT_FIELD(varnosyn);
587  READ_INT_FIELD(varattnosyn);
588  READ_LOCATION_FIELD(location);
589 
590  READ_DONE();
591 }
592 
593 /*
594  * _readConst
595  */
596 static Const *
598 {
600 
601  READ_OID_FIELD(consttype);
602  READ_INT_FIELD(consttypmod);
603  READ_OID_FIELD(constcollid);
604  READ_INT_FIELD(constlen);
605  READ_BOOL_FIELD(constbyval);
606  READ_BOOL_FIELD(constisnull);
607  READ_LOCATION_FIELD(location);
608 
609  token = pg_strtok(&length); /* skip :constvalue */
610  if (local_node->constisnull)
611  token = pg_strtok(&length); /* skip "<>" */
612  else
613  local_node->constvalue = readDatum(local_node->constbyval);
614 
615  READ_DONE();
616 }
617 
618 /*
619  * _readParam
620  */
621 static Param *
623 {
625 
626  READ_ENUM_FIELD(paramkind, ParamKind);
627  READ_INT_FIELD(paramid);
628  READ_OID_FIELD(paramtype);
629  READ_INT_FIELD(paramtypmod);
630  READ_OID_FIELD(paramcollid);
631  READ_LOCATION_FIELD(location);
632 
633  READ_DONE();
634 }
635 
636 /*
637  * _readAggref
638  */
639 static Aggref *
641 {
643 
644  READ_OID_FIELD(aggfnoid);
645  READ_OID_FIELD(aggtype);
646  READ_OID_FIELD(aggcollid);
647  READ_OID_FIELD(inputcollid);
648  READ_OID_FIELD(aggtranstype);
649  READ_NODE_FIELD(aggargtypes);
650  READ_NODE_FIELD(aggdirectargs);
652  READ_NODE_FIELD(aggorder);
653  READ_NODE_FIELD(aggdistinct);
654  READ_NODE_FIELD(aggfilter);
655  READ_BOOL_FIELD(aggstar);
656  READ_BOOL_FIELD(aggvariadic);
657  READ_CHAR_FIELD(aggkind);
658  READ_UINT_FIELD(agglevelsup);
659  READ_ENUM_FIELD(aggsplit, AggSplit);
660  READ_INT_FIELD(aggno);
661  READ_INT_FIELD(aggtransno);
662  READ_LOCATION_FIELD(location);
663 
664  READ_DONE();
665 }
666 
667 /*
668  * _readGroupingFunc
669  */
670 static GroupingFunc *
672 {
674 
676  READ_NODE_FIELD(refs);
677  READ_NODE_FIELD(cols);
678  READ_UINT_FIELD(agglevelsup);
679  READ_LOCATION_FIELD(location);
680 
681  READ_DONE();
682 }
683 
684 /*
685  * _readWindowFunc
686  */
687 static WindowFunc *
689 {
691 
692  READ_OID_FIELD(winfnoid);
693  READ_OID_FIELD(wintype);
694  READ_OID_FIELD(wincollid);
695  READ_OID_FIELD(inputcollid);
697  READ_NODE_FIELD(aggfilter);
698  READ_UINT_FIELD(winref);
699  READ_BOOL_FIELD(winstar);
700  READ_BOOL_FIELD(winagg);
701  READ_LOCATION_FIELD(location);
702 
703  READ_DONE();
704 }
705 
706 /*
707  * _readSubscriptingRef
708  */
709 static SubscriptingRef *
711 {
713 
714  READ_OID_FIELD(refcontainertype);
715  READ_OID_FIELD(refelemtype);
716  READ_OID_FIELD(refrestype);
717  READ_INT_FIELD(reftypmod);
718  READ_OID_FIELD(refcollid);
719  READ_NODE_FIELD(refupperindexpr);
720  READ_NODE_FIELD(reflowerindexpr);
721  READ_NODE_FIELD(refexpr);
722  READ_NODE_FIELD(refassgnexpr);
723 
724  READ_DONE();
725 }
726 
727 /*
728  * _readFuncExpr
729  */
730 static FuncExpr *
732 {
734 
735  READ_OID_FIELD(funcid);
736  READ_OID_FIELD(funcresulttype);
737  READ_BOOL_FIELD(funcretset);
738  READ_BOOL_FIELD(funcvariadic);
739  READ_ENUM_FIELD(funcformat, CoercionForm);
740  READ_OID_FIELD(funccollid);
741  READ_OID_FIELD(inputcollid);
743  READ_LOCATION_FIELD(location);
744 
745  READ_DONE();
746 }
747 
748 /*
749  * _readNamedArgExpr
750  */
751 static NamedArgExpr *
753 {
755 
758  READ_INT_FIELD(argnumber);
759  READ_LOCATION_FIELD(location);
760 
761  READ_DONE();
762 }
763 
764 /*
765  * _readOpExpr
766  */
767 static OpExpr *
769 {
771 
772  READ_OID_FIELD(opno);
773  READ_OID_FIELD(opfuncid);
774  READ_OID_FIELD(opresulttype);
775  READ_BOOL_FIELD(opretset);
776  READ_OID_FIELD(opcollid);
777  READ_OID_FIELD(inputcollid);
779  READ_LOCATION_FIELD(location);
780 
781  READ_DONE();
782 }
783 
784 /*
785  * _readDistinctExpr
786  */
787 static DistinctExpr *
789 {
791 
792  READ_OID_FIELD(opno);
793  READ_OID_FIELD(opfuncid);
794  READ_OID_FIELD(opresulttype);
795  READ_BOOL_FIELD(opretset);
796  READ_OID_FIELD(opcollid);
797  READ_OID_FIELD(inputcollid);
799  READ_LOCATION_FIELD(location);
800 
801  READ_DONE();
802 }
803 
804 /*
805  * _readNullIfExpr
806  */
807 static NullIfExpr *
809 {
811 
812  READ_OID_FIELD(opno);
813  READ_OID_FIELD(opfuncid);
814  READ_OID_FIELD(opresulttype);
815  READ_BOOL_FIELD(opretset);
816  READ_OID_FIELD(opcollid);
817  READ_OID_FIELD(inputcollid);
819  READ_LOCATION_FIELD(location);
820 
821  READ_DONE();
822 }
823 
824 /*
825  * _readScalarArrayOpExpr
826  */
827 static ScalarArrayOpExpr *
829 {
831 
832  READ_OID_FIELD(opno);
833  READ_OID_FIELD(opfuncid);
834  READ_OID_FIELD(hashfuncid);
835  READ_BOOL_FIELD(useOr);
836  READ_OID_FIELD(inputcollid);
838  READ_LOCATION_FIELD(location);
839 
840  READ_DONE();
841 }
842 
843 /*
844  * _readBoolExpr
845  */
846 static BoolExpr *
848 {
850 
851  /* do-it-yourself enum representation */
852  token = pg_strtok(&length); /* skip :boolop */
853  token = pg_strtok(&length); /* get field value */
854  if (strncmp(token, "and", 3) == 0)
855  local_node->boolop = AND_EXPR;
856  else if (strncmp(token, "or", 2) == 0)
857  local_node->boolop = OR_EXPR;
858  else if (strncmp(token, "not", 3) == 0)
859  local_node->boolop = NOT_EXPR;
860  else
861  elog(ERROR, "unrecognized boolop \"%.*s\"", length, token);
862 
864  READ_LOCATION_FIELD(location);
865 
866  READ_DONE();
867 }
868 
869 /*
870  * _readSubLink
871  */
872 static SubLink *
874 {
876 
877  READ_ENUM_FIELD(subLinkType, SubLinkType);
878  READ_INT_FIELD(subLinkId);
879  READ_NODE_FIELD(testexpr);
880  READ_NODE_FIELD(operName);
881  READ_NODE_FIELD(subselect);
882  READ_LOCATION_FIELD(location);
883 
884  READ_DONE();
885 }
886 
887 /*
888  * _readSubPlan is not needed since it doesn't appear in stored rules.
889  */
890 
891 /*
892  * _readFieldSelect
893  */
894 static FieldSelect *
896 {
898 
900  READ_INT_FIELD(fieldnum);
901  READ_OID_FIELD(resulttype);
902  READ_INT_FIELD(resulttypmod);
903  READ_OID_FIELD(resultcollid);
904 
905  READ_DONE();
906 }
907 
908 /*
909  * _readFieldStore
910  */
911 static FieldStore *
913 {
915 
917  READ_NODE_FIELD(newvals);
918  READ_NODE_FIELD(fieldnums);
919  READ_OID_FIELD(resulttype);
920 
921  READ_DONE();
922 }
923 
924 /*
925  * _readRelabelType
926  */
927 static RelabelType *
929 {
931 
933  READ_OID_FIELD(resulttype);
934  READ_INT_FIELD(resulttypmod);
935  READ_OID_FIELD(resultcollid);
936  READ_ENUM_FIELD(relabelformat, CoercionForm);
937  READ_LOCATION_FIELD(location);
938 
939  READ_DONE();
940 }
941 
942 /*
943  * _readCoerceViaIO
944  */
945 static CoerceViaIO *
947 {
949 
951  READ_OID_FIELD(resulttype);
952  READ_OID_FIELD(resultcollid);
953  READ_ENUM_FIELD(coerceformat, CoercionForm);
954  READ_LOCATION_FIELD(location);
955 
956  READ_DONE();
957 }
958 
959 /*
960  * _readArrayCoerceExpr
961  */
962 static ArrayCoerceExpr *
964 {
966 
968  READ_NODE_FIELD(elemexpr);
969  READ_OID_FIELD(resulttype);
970  READ_INT_FIELD(resulttypmod);
971  READ_OID_FIELD(resultcollid);
972  READ_ENUM_FIELD(coerceformat, CoercionForm);
973  READ_LOCATION_FIELD(location);
974 
975  READ_DONE();
976 }
977 
978 /*
979  * _readConvertRowtypeExpr
980  */
981 static ConvertRowtypeExpr *
983 {
985 
987  READ_OID_FIELD(resulttype);
988  READ_ENUM_FIELD(convertformat, CoercionForm);
989  READ_LOCATION_FIELD(location);
990 
991  READ_DONE();
992 }
993 
994 /*
995  * _readCollateExpr
996  */
997 static CollateExpr *
999 {
1001 
1003  READ_OID_FIELD(collOid);
1004  READ_LOCATION_FIELD(location);
1005 
1006  READ_DONE();
1007 }
1008 
1009 /*
1010  * _readCaseExpr
1011  */
1012 static CaseExpr *
1014 {
1016 
1017  READ_OID_FIELD(casetype);
1018  READ_OID_FIELD(casecollid);
1021  READ_NODE_FIELD(defresult);
1022  READ_LOCATION_FIELD(location);
1023 
1024  READ_DONE();
1025 }
1026 
1027 /*
1028  * _readCaseWhen
1029  */
1030 static CaseWhen *
1032 {
1034 
1035  READ_NODE_FIELD(expr);
1036  READ_NODE_FIELD(result);
1037  READ_LOCATION_FIELD(location);
1038 
1039  READ_DONE();
1040 }
1041 
1042 /*
1043  * _readCaseTestExpr
1044  */
1045 static CaseTestExpr *
1047 {
1049 
1050  READ_OID_FIELD(typeId);
1051  READ_INT_FIELD(typeMod);
1052  READ_OID_FIELD(collation);
1053 
1054  READ_DONE();
1055 }
1056 
1057 /*
1058  * _readArrayExpr
1059  */
1060 static ArrayExpr *
1062 {
1064 
1065  READ_OID_FIELD(array_typeid);
1066  READ_OID_FIELD(array_collid);
1067  READ_OID_FIELD(element_typeid);
1068  READ_NODE_FIELD(elements);
1069  READ_BOOL_FIELD(multidims);
1070  READ_LOCATION_FIELD(location);
1071 
1072  READ_DONE();
1073 }
1074 
1075 /*
1076  * _readRowExpr
1077  */
1078 static RowExpr *
1080 {
1082 
1084  READ_OID_FIELD(row_typeid);
1085  READ_ENUM_FIELD(row_format, CoercionForm);
1086  READ_NODE_FIELD(colnames);
1087  READ_LOCATION_FIELD(location);
1088 
1089  READ_DONE();
1090 }
1091 
1092 /*
1093  * _readRowCompareExpr
1094  */
1095 static RowCompareExpr *
1097 {
1099 
1101  READ_NODE_FIELD(opnos);
1102  READ_NODE_FIELD(opfamilies);
1103  READ_NODE_FIELD(inputcollids);
1104  READ_NODE_FIELD(largs);
1105  READ_NODE_FIELD(rargs);
1106 
1107  READ_DONE();
1108 }
1109 
1110 /*
1111  * _readCoalesceExpr
1112  */
1113 static CoalesceExpr *
1115 {
1117 
1118  READ_OID_FIELD(coalescetype);
1119  READ_OID_FIELD(coalescecollid);
1121  READ_LOCATION_FIELD(location);
1122 
1123  READ_DONE();
1124 }
1125 
1126 /*
1127  * _readMinMaxExpr
1128  */
1129 static MinMaxExpr *
1131 {
1133 
1134  READ_OID_FIELD(minmaxtype);
1135  READ_OID_FIELD(minmaxcollid);
1136  READ_OID_FIELD(inputcollid);
1139  READ_LOCATION_FIELD(location);
1140 
1141  READ_DONE();
1142 }
1143 
1144 /*
1145  * _readSQLValueFunction
1146  */
1147 static SQLValueFunction *
1149 {
1151 
1154  READ_INT_FIELD(typmod);
1155  READ_LOCATION_FIELD(location);
1156 
1157  READ_DONE();
1158 }
1159 
1160 /*
1161  * _readXmlExpr
1162  */
1163 static XmlExpr *
1165 {
1167 
1170  READ_NODE_FIELD(named_args);
1171  READ_NODE_FIELD(arg_names);
1175  READ_INT_FIELD(typmod);
1176  READ_LOCATION_FIELD(location);
1177 
1178  READ_DONE();
1179 }
1180 
1181 /*
1182  * _readNullTest
1183  */
1184 static NullTest *
1186 {
1188 
1190  READ_ENUM_FIELD(nulltesttype, NullTestType);
1191  READ_BOOL_FIELD(argisrow);
1192  READ_LOCATION_FIELD(location);
1193 
1194  READ_DONE();
1195 }
1196 
1197 /*
1198  * _readBooleanTest
1199  */
1200 static BooleanTest *
1202 {
1204 
1206  READ_ENUM_FIELD(booltesttype, BoolTestType);
1207  READ_LOCATION_FIELD(location);
1208 
1209  READ_DONE();
1210 }
1211 
1212 /*
1213  * _readCoerceToDomain
1214  */
1215 static CoerceToDomain *
1217 {
1219 
1221  READ_OID_FIELD(resulttype);
1222  READ_INT_FIELD(resulttypmod);
1223  READ_OID_FIELD(resultcollid);
1224  READ_ENUM_FIELD(coercionformat, CoercionForm);
1225  READ_LOCATION_FIELD(location);
1226 
1227  READ_DONE();
1228 }
1229 
1230 /*
1231  * _readCoerceToDomainValue
1232  */
1233 static CoerceToDomainValue *
1235 {
1237 
1238  READ_OID_FIELD(typeId);
1239  READ_INT_FIELD(typeMod);
1240  READ_OID_FIELD(collation);
1241  READ_LOCATION_FIELD(location);
1242 
1243  READ_DONE();
1244 }
1245 
1246 /*
1247  * _readSetToDefault
1248  */
1249 static SetToDefault *
1251 {
1253 
1254  READ_OID_FIELD(typeId);
1255  READ_INT_FIELD(typeMod);
1256  READ_OID_FIELD(collation);
1257  READ_LOCATION_FIELD(location);
1258 
1259  READ_DONE();
1260 }
1261 
1262 /*
1263  * _readCurrentOfExpr
1264  */
1265 static CurrentOfExpr *
1267 {
1269 
1270  READ_UINT_FIELD(cvarno);
1271  READ_STRING_FIELD(cursor_name);
1272  READ_INT_FIELD(cursor_param);
1273 
1274  READ_DONE();
1275 }
1276 
1277 /*
1278  * _readNextValueExpr
1279  */
1280 static NextValueExpr *
1282 {
1284 
1285  READ_OID_FIELD(seqid);
1286  READ_OID_FIELD(typeId);
1287 
1288  READ_DONE();
1289 }
1290 
1291 /*
1292  * _readInferenceElem
1293  */
1294 static InferenceElem *
1296 {
1298 
1299  READ_NODE_FIELD(expr);
1300  READ_OID_FIELD(infercollid);
1301  READ_OID_FIELD(inferopclass);
1302 
1303  READ_DONE();
1304 }
1305 
1306 /*
1307  * _readTargetEntry
1308  */
1309 static TargetEntry *
1311 {
1313 
1314  READ_NODE_FIELD(expr);
1315  READ_INT_FIELD(resno);
1316  READ_STRING_FIELD(resname);
1317  READ_UINT_FIELD(ressortgroupref);
1318  READ_OID_FIELD(resorigtbl);
1319  READ_INT_FIELD(resorigcol);
1320  READ_BOOL_FIELD(resjunk);
1321 
1322  READ_DONE();
1323 }
1324 
1325 /*
1326  * _readRangeTblRef
1327  */
1328 static RangeTblRef *
1330 {
1332 
1333  READ_INT_FIELD(rtindex);
1334 
1335  READ_DONE();
1336 }
1337 
1338 /*
1339  * _readJoinExpr
1340  */
1341 static JoinExpr *
1343 {
1345 
1346  READ_ENUM_FIELD(jointype, JoinType);
1347  READ_BOOL_FIELD(isNatural);
1348  READ_NODE_FIELD(larg);
1349  READ_NODE_FIELD(rarg);
1350  READ_NODE_FIELD(usingClause);
1351  READ_NODE_FIELD(join_using_alias);
1352  READ_NODE_FIELD(quals);
1353  READ_NODE_FIELD(alias);
1354  READ_INT_FIELD(rtindex);
1355 
1356  READ_DONE();
1357 }
1358 
1359 /*
1360  * _readFromExpr
1361  */
1362 static FromExpr *
1364 {
1366 
1367  READ_NODE_FIELD(fromlist);
1368  READ_NODE_FIELD(quals);
1369 
1370  READ_DONE();
1371 }
1372 
1373 /*
1374  * _readOnConflictExpr
1375  */
1376 static OnConflictExpr *
1378 {
1380 
1382  READ_NODE_FIELD(arbiterElems);
1383  READ_NODE_FIELD(arbiterWhere);
1384  READ_OID_FIELD(constraint);
1385  READ_NODE_FIELD(onConflictSet);
1386  READ_NODE_FIELD(onConflictWhere);
1387  READ_INT_FIELD(exclRelIndex);
1388  READ_NODE_FIELD(exclRelTlist);
1389 
1390  READ_DONE();
1391 }
1392 
1393 /*
1394  * Stuff from pathnodes.h.
1395  *
1396  * Mostly we don't need to read planner nodes back in again, but some
1397  * of these also end up in plan trees.
1398  */
1399 
1400 /*
1401  * _readAppendRelInfo
1402  */
1403 static AppendRelInfo *
1405 {
1407 
1408  READ_UINT_FIELD(parent_relid);
1409  READ_UINT_FIELD(child_relid);
1410  READ_OID_FIELD(parent_reltype);
1411  READ_OID_FIELD(child_reltype);
1412  READ_NODE_FIELD(translated_vars);
1413  READ_INT_FIELD(num_child_cols);
1414  READ_ATTRNUMBER_ARRAY(parent_colnos, local_node->num_child_cols);
1415  READ_OID_FIELD(parent_reloid);
1416 
1417  READ_DONE();
1418 }
1419 
1420 /*
1421  * Stuff from parsenodes.h.
1422  */
1423 
1424 /*
1425  * _readRangeTblEntry
1426  */
1427 static RangeTblEntry *
1429 {
1431 
1432  /* put alias + eref first to make dump more legible */
1433  READ_NODE_FIELD(alias);
1434  READ_NODE_FIELD(eref);
1435  READ_ENUM_FIELD(rtekind, RTEKind);
1436 
1437  switch (local_node->rtekind)
1438  {
1439  case RTE_RELATION:
1440  READ_OID_FIELD(relid);
1441  READ_CHAR_FIELD(relkind);
1442  READ_INT_FIELD(rellockmode);
1443  READ_NODE_FIELD(tablesample);
1444  break;
1445  case RTE_SUBQUERY:
1446  READ_NODE_FIELD(subquery);
1447  READ_BOOL_FIELD(security_barrier);
1448  break;
1449  case RTE_JOIN:
1450  READ_ENUM_FIELD(jointype, JoinType);
1451  READ_INT_FIELD(joinmergedcols);
1452  READ_NODE_FIELD(joinaliasvars);
1453  READ_NODE_FIELD(joinleftcols);
1454  READ_NODE_FIELD(joinrightcols);
1455  READ_NODE_FIELD(join_using_alias);
1456  break;
1457  case RTE_FUNCTION:
1459  READ_BOOL_FIELD(funcordinality);
1460  break;
1461  case RTE_TABLEFUNC:
1462  READ_NODE_FIELD(tablefunc);
1463  /* The RTE must have a copy of the column type info, if any */
1464  if (local_node->tablefunc)
1465  {
1466  TableFunc *tf = local_node->tablefunc;
1467 
1468  local_node->coltypes = tf->coltypes;
1469  local_node->coltypmods = tf->coltypmods;
1470  local_node->colcollations = tf->colcollations;
1471  }
1472  break;
1473  case RTE_VALUES:
1474  READ_NODE_FIELD(values_lists);
1475  READ_NODE_FIELD(coltypes);
1476  READ_NODE_FIELD(coltypmods);
1477  READ_NODE_FIELD(colcollations);
1478  break;
1479  case RTE_CTE:
1480  READ_STRING_FIELD(ctename);
1481  READ_UINT_FIELD(ctelevelsup);
1482  READ_BOOL_FIELD(self_reference);
1483  READ_NODE_FIELD(coltypes);
1484  READ_NODE_FIELD(coltypmods);
1485  READ_NODE_FIELD(colcollations);
1486  break;
1487  case RTE_NAMEDTUPLESTORE:
1488  READ_STRING_FIELD(enrname);
1489  READ_FLOAT_FIELD(enrtuples);
1490  READ_OID_FIELD(relid);
1491  READ_NODE_FIELD(coltypes);
1492  READ_NODE_FIELD(coltypmods);
1493  READ_NODE_FIELD(colcollations);
1494  break;
1495  case RTE_RESULT:
1496  /* no extra fields */
1497  break;
1498  default:
1499  elog(ERROR, "unrecognized RTE kind: %d",
1500  (int) local_node->rtekind);
1501  break;
1502  }
1503 
1504  READ_BOOL_FIELD(lateral);
1505  READ_BOOL_FIELD(inh);
1506  READ_BOOL_FIELD(inFromCl);
1507  READ_UINT_FIELD(requiredPerms);
1508  READ_OID_FIELD(checkAsUser);
1509  READ_BITMAPSET_FIELD(selectedCols);
1510  READ_BITMAPSET_FIELD(insertedCols);
1511  READ_BITMAPSET_FIELD(updatedCols);
1512  READ_BITMAPSET_FIELD(extraUpdatedCols);
1513  READ_NODE_FIELD(securityQuals);
1514 
1515  READ_DONE();
1516 }
1517 
1518 /*
1519  * _readRangeTblFunction
1520  */
1521 static RangeTblFunction *
1523 {
1525 
1526  READ_NODE_FIELD(funcexpr);
1527  READ_INT_FIELD(funccolcount);
1528  READ_NODE_FIELD(funccolnames);
1529  READ_NODE_FIELD(funccoltypes);
1530  READ_NODE_FIELD(funccoltypmods);
1531  READ_NODE_FIELD(funccolcollations);
1532  READ_BITMAPSET_FIELD(funcparams);
1533 
1534  READ_DONE();
1535 }
1536 
1537 /*
1538  * _readTableSampleClause
1539  */
1540 static TableSampleClause *
1542 {
1544 
1545  READ_OID_FIELD(tsmhandler);
1547  READ_NODE_FIELD(repeatable);
1548 
1549  READ_DONE();
1550 }
1551 
1552 /*
1553  * _readDefElem
1554  */
1555 static DefElem *
1557 {
1559 
1560  READ_STRING_FIELD(defnamespace);
1561  READ_STRING_FIELD(defname);
1563  READ_ENUM_FIELD(defaction, DefElemAction);
1564  READ_LOCATION_FIELD(location);
1565 
1566  READ_DONE();
1567 }
1568 
1569 /*
1570  * Stuff from plannodes.h.
1571  */
1572 
1573 /*
1574  * _readPlannedStmt
1575  */
1576 static PlannedStmt *
1578 {
1580 
1581  READ_ENUM_FIELD(commandType, CmdType);
1582  READ_UINT64_FIELD(queryId);
1583  READ_BOOL_FIELD(hasReturning);
1584  READ_BOOL_FIELD(hasModifyingCTE);
1585  READ_BOOL_FIELD(canSetTag);
1586  READ_BOOL_FIELD(transientPlan);
1587  READ_BOOL_FIELD(dependsOnRole);
1588  READ_BOOL_FIELD(parallelModeNeeded);
1589  READ_INT_FIELD(jitFlags);
1590  READ_NODE_FIELD(planTree);
1591  READ_NODE_FIELD(rtable);
1592  READ_NODE_FIELD(resultRelations);
1593  READ_NODE_FIELD(appendRelations);
1594  READ_NODE_FIELD(subplans);
1595  READ_BITMAPSET_FIELD(rewindPlanIDs);
1596  READ_NODE_FIELD(rowMarks);
1597  READ_NODE_FIELD(relationOids);
1598  READ_NODE_FIELD(invalItems);
1599  READ_NODE_FIELD(paramExecTypes);
1600  READ_NODE_FIELD(utilityStmt);
1601  READ_LOCATION_FIELD(stmt_location);
1602  READ_INT_FIELD(stmt_len);
1603 
1604  READ_DONE();
1605 }
1606 
1607 /*
1608  * ReadCommonPlan
1609  * Assign the basic stuff of all nodes that inherit from Plan
1610  */
1611 static void
1612 ReadCommonPlan(Plan *local_node)
1613 {
1614  READ_TEMP_LOCALS();
1615 
1616  READ_FLOAT_FIELD(startup_cost);
1617  READ_FLOAT_FIELD(total_cost);
1618  READ_FLOAT_FIELD(plan_rows);
1619  READ_INT_FIELD(plan_width);
1620  READ_BOOL_FIELD(parallel_aware);
1621  READ_BOOL_FIELD(parallel_safe);
1622  READ_BOOL_FIELD(async_capable);
1623  READ_INT_FIELD(plan_node_id);
1624  READ_NODE_FIELD(targetlist);
1625  READ_NODE_FIELD(qual);
1626  READ_NODE_FIELD(lefttree);
1627  READ_NODE_FIELD(righttree);
1628  READ_NODE_FIELD(initPlan);
1629  READ_BITMAPSET_FIELD(extParam);
1630  READ_BITMAPSET_FIELD(allParam);
1631 }
1632 
1633 /*
1634  * _readPlan
1635  */
1636 static Plan *
1638 {
1640 
1641  ReadCommonPlan(local_node);
1642 
1643  READ_DONE();
1644 }
1645 
1646 /*
1647  * _readResult
1648  */
1649 static Result *
1651 {
1653 
1654  ReadCommonPlan(&local_node->plan);
1655 
1656  READ_NODE_FIELD(resconstantqual);
1657 
1658  READ_DONE();
1659 }
1660 
1661 /*
1662  * _readProjectSet
1663  */
1664 static ProjectSet *
1666 {
1668 
1669  ReadCommonPlan(&local_node->plan);
1670 
1671  READ_DONE();
1672 }
1673 
1674 /*
1675  * _readModifyTable
1676  */
1677 static ModifyTable *
1679 {
1681 
1682  ReadCommonPlan(&local_node->plan);
1683 
1684  READ_ENUM_FIELD(operation, CmdType);
1685  READ_BOOL_FIELD(canSetTag);
1686  READ_UINT_FIELD(nominalRelation);
1687  READ_UINT_FIELD(rootRelation);
1688  READ_BOOL_FIELD(partColsUpdated);
1689  READ_NODE_FIELD(resultRelations);
1690  READ_NODE_FIELD(updateColnosLists);
1691  READ_NODE_FIELD(withCheckOptionLists);
1692  READ_NODE_FIELD(returningLists);
1693  READ_NODE_FIELD(fdwPrivLists);
1694  READ_BITMAPSET_FIELD(fdwDirectModifyPlans);
1695  READ_NODE_FIELD(rowMarks);
1696  READ_INT_FIELD(epqParam);
1697  READ_ENUM_FIELD(onConflictAction, OnConflictAction);
1698  READ_NODE_FIELD(arbiterIndexes);
1699  READ_NODE_FIELD(onConflictSet);
1700  READ_NODE_FIELD(onConflictCols);
1701  READ_NODE_FIELD(onConflictWhere);
1702  READ_UINT_FIELD(exclRelRTI);
1703  READ_NODE_FIELD(exclRelTlist);
1704 
1705  READ_DONE();
1706 }
1707 
1708 /*
1709  * _readAppend
1710  */
1711 static Append *
1713 {
1715 
1716  ReadCommonPlan(&local_node->plan);
1717 
1718  READ_BITMAPSET_FIELD(apprelids);
1719  READ_NODE_FIELD(appendplans);
1720  READ_INT_FIELD(nasyncplans);
1721  READ_INT_FIELD(first_partial_plan);
1722  READ_NODE_FIELD(part_prune_info);
1723 
1724  READ_DONE();
1725 }
1726 
1727 /*
1728  * _readMergeAppend
1729  */
1730 static MergeAppend *
1732 {
1734 
1735  ReadCommonPlan(&local_node->plan);
1736 
1737  READ_BITMAPSET_FIELD(apprelids);
1738  READ_NODE_FIELD(mergeplans);
1739  READ_INT_FIELD(numCols);
1740  READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
1741  READ_OID_ARRAY(sortOperators, local_node->numCols);
1742  READ_OID_ARRAY(collations, local_node->numCols);
1743  READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
1744  READ_NODE_FIELD(part_prune_info);
1745 
1746  READ_DONE();
1747 }
1748 
1749 /*
1750  * _readRecursiveUnion
1751  */
1752 static RecursiveUnion *
1754 {
1756 
1757  ReadCommonPlan(&local_node->plan);
1758 
1759  READ_INT_FIELD(wtParam);
1760  READ_INT_FIELD(numCols);
1761  READ_ATTRNUMBER_ARRAY(dupColIdx, local_node->numCols);
1762  READ_OID_ARRAY(dupOperators, local_node->numCols);
1763  READ_OID_ARRAY(dupCollations, local_node->numCols);
1764  READ_LONG_FIELD(numGroups);
1765 
1766  READ_DONE();
1767 }
1768 
1769 /*
1770  * _readBitmapAnd
1771  */
1772 static BitmapAnd *
1774 {
1776 
1777  ReadCommonPlan(&local_node->plan);
1778 
1779  READ_NODE_FIELD(bitmapplans);
1780 
1781  READ_DONE();
1782 }
1783 
1784 /*
1785  * _readBitmapOr
1786  */
1787 static BitmapOr *
1789 {
1791 
1792  ReadCommonPlan(&local_node->plan);
1793 
1794  READ_BOOL_FIELD(isshared);
1795  READ_NODE_FIELD(bitmapplans);
1796 
1797  READ_DONE();
1798 }
1799 
1800 /*
1801  * ReadCommonScan
1802  * Assign the basic stuff of all nodes that inherit from Scan
1803  */
1804 static void
1805 ReadCommonScan(Scan *local_node)
1806 {
1807  READ_TEMP_LOCALS();
1808 
1809  ReadCommonPlan(&local_node->plan);
1810 
1811  READ_UINT_FIELD(scanrelid);
1812 }
1813 
1814 /*
1815  * _readScan
1816  */
1817 static Scan *
1819 {
1821 
1822  ReadCommonScan(local_node);
1823 
1824  READ_DONE();
1825 }
1826 
1827 /*
1828  * _readSeqScan
1829  */
1830 static SeqScan *
1832 {
1834 
1835  ReadCommonScan(local_node);
1836 
1837  READ_DONE();
1838 }
1839 
1840 /*
1841  * _readSampleScan
1842  */
1843 static SampleScan *
1845 {
1847 
1848  ReadCommonScan(&local_node->scan);
1849 
1850  READ_NODE_FIELD(tablesample);
1851 
1852  READ_DONE();
1853 }
1854 
1855 /*
1856  * _readIndexScan
1857  */
1858 static IndexScan *
1860 {
1862 
1863  ReadCommonScan(&local_node->scan);
1864 
1865  READ_OID_FIELD(indexid);
1866  READ_NODE_FIELD(indexqual);
1867  READ_NODE_FIELD(indexqualorig);
1868  READ_NODE_FIELD(indexorderby);
1869  READ_NODE_FIELD(indexorderbyorig);
1870  READ_NODE_FIELD(indexorderbyops);
1871  READ_ENUM_FIELD(indexorderdir, ScanDirection);
1872 
1873  READ_DONE();
1874 }
1875 
1876 /*
1877  * _readIndexOnlyScan
1878  */
1879 static IndexOnlyScan *
1881 {
1883 
1884  ReadCommonScan(&local_node->scan);
1885 
1886  READ_OID_FIELD(indexid);
1887  READ_NODE_FIELD(indexqual);
1888  READ_NODE_FIELD(indexorderby);
1889  READ_NODE_FIELD(indextlist);
1890  READ_ENUM_FIELD(indexorderdir, ScanDirection);
1891 
1892  READ_DONE();
1893 }
1894 
1895 /*
1896  * _readBitmapIndexScan
1897  */
1898 static BitmapIndexScan *
1900 {
1902 
1903  ReadCommonScan(&local_node->scan);
1904 
1905  READ_OID_FIELD(indexid);
1906  READ_BOOL_FIELD(isshared);
1907  READ_NODE_FIELD(indexqual);
1908  READ_NODE_FIELD(indexqualorig);
1909 
1910  READ_DONE();
1911 }
1912 
1913 /*
1914  * _readBitmapHeapScan
1915  */
1916 static BitmapHeapScan *
1918 {
1920 
1921  ReadCommonScan(&local_node->scan);
1922 
1923  READ_NODE_FIELD(bitmapqualorig);
1924 
1925  READ_DONE();
1926 }
1927 
1928 /*
1929  * _readTidScan
1930  */
1931 static TidScan *
1933 {
1935 
1936  ReadCommonScan(&local_node->scan);
1937 
1938  READ_NODE_FIELD(tidquals);
1939 
1940  READ_DONE();
1941 }
1942 
1943 /*
1944  * _readTidRangeScan
1945  */
1946 static TidRangeScan *
1948 {
1950 
1951  ReadCommonScan(&local_node->scan);
1952 
1953  READ_NODE_FIELD(tidrangequals);
1954 
1955  READ_DONE();
1956 }
1957 
1958 /*
1959  * _readSubqueryScan
1960  */
1961 static SubqueryScan *
1963 {
1965 
1966  ReadCommonScan(&local_node->scan);
1967 
1968  READ_NODE_FIELD(subplan);
1969 
1970  READ_DONE();
1971 }
1972 
1973 /*
1974  * _readFunctionScan
1975  */
1976 static FunctionScan *
1978 {
1980 
1981  ReadCommonScan(&local_node->scan);
1982 
1984  READ_BOOL_FIELD(funcordinality);
1985 
1986  READ_DONE();
1987 }
1988 
1989 /*
1990  * _readValuesScan
1991  */
1992 static ValuesScan *
1994 {
1996 
1997  ReadCommonScan(&local_node->scan);
1998 
1999  READ_NODE_FIELD(values_lists);
2000 
2001  READ_DONE();
2002 }
2003 
2004 /*
2005  * _readTableFuncScan
2006  */
2007 static TableFuncScan *
2009 {
2011 
2012  ReadCommonScan(&local_node->scan);
2013 
2014  READ_NODE_FIELD(tablefunc);
2015 
2016  READ_DONE();
2017 }
2018 
2019 /*
2020  * _readCteScan
2021  */
2022 static CteScan *
2024 {
2026 
2027  ReadCommonScan(&local_node->scan);
2028 
2029  READ_INT_FIELD(ctePlanId);
2030  READ_INT_FIELD(cteParam);
2031 
2032  READ_DONE();
2033 }
2034 
2035 /*
2036  * _readNamedTuplestoreScan
2037  */
2038 static NamedTuplestoreScan *
2040 {
2042 
2043  ReadCommonScan(&local_node->scan);
2044 
2045  READ_STRING_FIELD(enrname);
2046 
2047  READ_DONE();
2048 }
2049 
2050 /*
2051  * _readWorkTableScan
2052  */
2053 static WorkTableScan *
2055 {
2057 
2058  ReadCommonScan(&local_node->scan);
2059 
2060  READ_INT_FIELD(wtParam);
2061 
2062  READ_DONE();
2063 }
2064 
2065 /*
2066  * _readForeignScan
2067  */
2068 static ForeignScan *
2070 {
2072 
2073  ReadCommonScan(&local_node->scan);
2074 
2075  READ_ENUM_FIELD(operation, CmdType);
2076  READ_OID_FIELD(fs_server);
2077  READ_NODE_FIELD(fdw_exprs);
2078  READ_NODE_FIELD(fdw_private);
2079  READ_NODE_FIELD(fdw_scan_tlist);
2080  READ_NODE_FIELD(fdw_recheck_quals);
2081  READ_BITMAPSET_FIELD(fs_relids);
2082  READ_BOOL_FIELD(fsSystemCol);
2083  READ_INT_FIELD(resultRelation);
2084 
2085  READ_DONE();
2086 }
2087 
2088 /*
2089  * _readCustomScan
2090  */
2091 static CustomScan *
2093 {
2095  char *custom_name;
2096  const CustomScanMethods *methods;
2097 
2098  ReadCommonScan(&local_node->scan);
2099 
2100  READ_UINT_FIELD(flags);
2101  READ_NODE_FIELD(custom_plans);
2102  READ_NODE_FIELD(custom_exprs);
2103  READ_NODE_FIELD(custom_private);
2104  READ_NODE_FIELD(custom_scan_tlist);
2105  READ_BITMAPSET_FIELD(custom_relids);
2106 
2107  /* Lookup CustomScanMethods by CustomName */
2108  token = pg_strtok(&length); /* skip methods: */
2109  token = pg_strtok(&length); /* CustomName */
2110  custom_name = nullable_string(token, length);
2111  methods = GetCustomScanMethods(custom_name, false);
2112  local_node->methods = methods;
2113 
2114  READ_DONE();
2115 }
2116 
2117 /*
2118  * ReadCommonJoin
2119  * Assign the basic stuff of all nodes that inherit from Join
2120  */
2121 static void
2122 ReadCommonJoin(Join *local_node)
2123 {
2124  READ_TEMP_LOCALS();
2125 
2126  ReadCommonPlan(&local_node->plan);
2127 
2128  READ_ENUM_FIELD(jointype, JoinType);
2129  READ_BOOL_FIELD(inner_unique);
2130  READ_NODE_FIELD(joinqual);
2131 }
2132 
2133 /*
2134  * _readJoin
2135  */
2136 static Join *
2138 {
2140 
2141  ReadCommonJoin(local_node);
2142 
2143  READ_DONE();
2144 }
2145 
2146 /*
2147  * _readNestLoop
2148  */
2149 static NestLoop *
2151 {
2153 
2154  ReadCommonJoin(&local_node->join);
2155 
2156  READ_NODE_FIELD(nestParams);
2157 
2158  READ_DONE();
2159 }
2160 
2161 /*
2162  * _readMergeJoin
2163  */
2164 static MergeJoin *
2166 {
2167  int numCols;
2168 
2170 
2171  ReadCommonJoin(&local_node->join);
2172 
2173  READ_BOOL_FIELD(skip_mark_restore);
2174  READ_NODE_FIELD(mergeclauses);
2175 
2176  numCols = list_length(local_node->mergeclauses);
2177 
2178  READ_OID_ARRAY(mergeFamilies, numCols);
2179  READ_OID_ARRAY(mergeCollations, numCols);
2180  READ_INT_ARRAY(mergeStrategies, numCols);
2181  READ_BOOL_ARRAY(mergeNullsFirst, numCols);
2182 
2183  READ_DONE();
2184 }
2185 
2186 /*
2187  * _readHashJoin
2188  */
2189 static HashJoin *
2191 {
2193 
2194  ReadCommonJoin(&local_node->join);
2195 
2196  READ_NODE_FIELD(hashclauses);
2197  READ_NODE_FIELD(hashoperators);
2198  READ_NODE_FIELD(hashcollations);
2199  READ_NODE_FIELD(hashkeys);
2200 
2201  READ_DONE();
2202 }
2203 
2204 /*
2205  * _readMaterial
2206  */
2207 static Material *
2209 {
2211 
2212  ReadCommonPlan(&local_node->plan);
2213 
2214  READ_DONE();
2215 }
2216 
2217 /*
2218  * _readResultCache
2219  */
2220 static ResultCache *
2222 {
2224 
2225  ReadCommonPlan(&local_node->plan);
2226 
2227  READ_INT_FIELD(numKeys);
2228  READ_OID_ARRAY(hashOperators, local_node->numKeys);
2229  READ_OID_ARRAY(collations, local_node->numKeys);
2230  READ_NODE_FIELD(param_exprs);
2231  READ_BOOL_FIELD(singlerow);
2232  READ_UINT_FIELD(est_entries);
2233 
2234  READ_DONE();
2235 }
2236 
2237 /*
2238  * ReadCommonSort
2239  * Assign the basic stuff of all nodes that inherit from Sort
2240  */
2241 static void
2242 ReadCommonSort(Sort *local_node)
2243 {
2244  READ_TEMP_LOCALS();
2245 
2246  ReadCommonPlan(&local_node->plan);
2247 
2248  READ_INT_FIELD(numCols);
2249  READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
2250  READ_OID_ARRAY(sortOperators, local_node->numCols);
2251  READ_OID_ARRAY(collations, local_node->numCols);
2252  READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
2253 }
2254 
2255 /*
2256  * _readSort
2257  */
2258 static Sort *
2260 {
2262 
2263  ReadCommonSort(local_node);
2264 
2265  READ_DONE();
2266 }
2267 
2268 /*
2269  * _readIncrementalSort
2270  */
2271 static IncrementalSort *
2273 {
2275 
2276  ReadCommonSort(&local_node->sort);
2277 
2278  READ_INT_FIELD(nPresortedCols);
2279 
2280  READ_DONE();
2281 }
2282 
2283 /*
2284  * _readGroup
2285  */
2286 static Group *
2288 {
2289  READ_LOCALS(Group);
2290 
2291  ReadCommonPlan(&local_node->plan);
2292 
2293  READ_INT_FIELD(numCols);
2294  READ_ATTRNUMBER_ARRAY(grpColIdx, local_node->numCols);
2295  READ_OID_ARRAY(grpOperators, local_node->numCols);
2296  READ_OID_ARRAY(grpCollations, local_node->numCols);
2297 
2298  READ_DONE();
2299 }
2300 
2301 /*
2302  * _readAgg
2303  */
2304 static Agg *
2306 {
2307  READ_LOCALS(Agg);
2308 
2309  ReadCommonPlan(&local_node->plan);
2310 
2311  READ_ENUM_FIELD(aggstrategy, AggStrategy);
2312  READ_ENUM_FIELD(aggsplit, AggSplit);
2313  READ_INT_FIELD(numCols);
2314  READ_ATTRNUMBER_ARRAY(grpColIdx, local_node->numCols);
2315  READ_OID_ARRAY(grpOperators, local_node->numCols);
2316  READ_OID_ARRAY(grpCollations, local_node->numCols);
2317  READ_LONG_FIELD(numGroups);
2318  READ_UINT64_FIELD(transitionSpace);
2319  READ_BITMAPSET_FIELD(aggParams);
2320  READ_NODE_FIELD(groupingSets);
2321  READ_NODE_FIELD(chain);
2322 
2323  READ_DONE();
2324 }
2325 
2326 /*
2327  * _readWindowAgg
2328  */
2329 static WindowAgg *
2331 {
2333 
2334  ReadCommonPlan(&local_node->plan);
2335 
2336  READ_UINT_FIELD(winref);
2337  READ_INT_FIELD(partNumCols);
2338  READ_ATTRNUMBER_ARRAY(partColIdx, local_node->partNumCols);
2339  READ_OID_ARRAY(partOperators, local_node->partNumCols);
2340  READ_OID_ARRAY(partCollations, local_node->partNumCols);
2341  READ_INT_FIELD(ordNumCols);
2342  READ_ATTRNUMBER_ARRAY(ordColIdx, local_node->ordNumCols);
2343  READ_OID_ARRAY(ordOperators, local_node->ordNumCols);
2344  READ_OID_ARRAY(ordCollations, local_node->ordNumCols);
2345  READ_INT_FIELD(frameOptions);
2346  READ_NODE_FIELD(startOffset);
2347  READ_NODE_FIELD(endOffset);
2348  READ_OID_FIELD(startInRangeFunc);
2349  READ_OID_FIELD(endInRangeFunc);
2350  READ_OID_FIELD(inRangeColl);
2351  READ_BOOL_FIELD(inRangeAsc);
2352  READ_BOOL_FIELD(inRangeNullsFirst);
2353 
2354  READ_DONE();
2355 }
2356 
2357 /*
2358  * _readUnique
2359  */
2360 static Unique *
2362 {
2364 
2365  ReadCommonPlan(&local_node->plan);
2366 
2367  READ_INT_FIELD(numCols);
2368  READ_ATTRNUMBER_ARRAY(uniqColIdx, local_node->numCols);
2369  READ_OID_ARRAY(uniqOperators, local_node->numCols);
2370  READ_OID_ARRAY(uniqCollations, local_node->numCols);
2371 
2372  READ_DONE();
2373 }
2374 
2375 /*
2376  * _readGather
2377  */
2378 static Gather *
2380 {
2382 
2383  ReadCommonPlan(&local_node->plan);
2384 
2385  READ_INT_FIELD(num_workers);
2386  READ_INT_FIELD(rescan_param);
2387  READ_BOOL_FIELD(single_copy);
2388  READ_BOOL_FIELD(invisible);
2389  READ_BITMAPSET_FIELD(initParam);
2390 
2391  READ_DONE();
2392 }
2393 
2394 /*
2395  * _readGatherMerge
2396  */
2397 static GatherMerge *
2399 {
2401 
2402  ReadCommonPlan(&local_node->plan);
2403 
2404  READ_INT_FIELD(num_workers);
2405  READ_INT_FIELD(rescan_param);
2406  READ_INT_FIELD(numCols);
2407  READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
2408  READ_OID_ARRAY(sortOperators, local_node->numCols);
2409  READ_OID_ARRAY(collations, local_node->numCols);
2410  READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
2411  READ_BITMAPSET_FIELD(initParam);
2412 
2413  READ_DONE();
2414 }
2415 
2416 /*
2417  * _readHash
2418  */
2419 static Hash *
2421 {
2422  READ_LOCALS(Hash);
2423 
2424  ReadCommonPlan(&local_node->plan);
2425 
2426  READ_NODE_FIELD(hashkeys);
2427  READ_OID_FIELD(skewTable);
2428  READ_INT_FIELD(skewColumn);
2429  READ_BOOL_FIELD(skewInherit);
2430  READ_FLOAT_FIELD(rows_total);
2431 
2432  READ_DONE();
2433 }
2434 
2435 /*
2436  * _readSetOp
2437  */
2438 static SetOp *
2440 {
2441  READ_LOCALS(SetOp);
2442 
2443  ReadCommonPlan(&local_node->plan);
2444 
2445  READ_ENUM_FIELD(cmd, SetOpCmd);
2446  READ_ENUM_FIELD(strategy, SetOpStrategy);
2447  READ_INT_FIELD(numCols);
2448  READ_ATTRNUMBER_ARRAY(dupColIdx, local_node->numCols);
2449  READ_OID_ARRAY(dupOperators, local_node->numCols);
2450  READ_OID_ARRAY(dupCollations, local_node->numCols);
2451  READ_INT_FIELD(flagColIdx);
2452  READ_INT_FIELD(firstFlag);
2453  READ_LONG_FIELD(numGroups);
2454 
2455  READ_DONE();
2456 }
2457 
2458 /*
2459  * _readLockRows
2460  */
2461 static LockRows *
2463 {
2465 
2466  ReadCommonPlan(&local_node->plan);
2467 
2468  READ_NODE_FIELD(rowMarks);
2469  READ_INT_FIELD(epqParam);
2470 
2471  READ_DONE();
2472 }
2473 
2474 /*
2475  * _readLimit
2476  */
2477 static Limit *
2479 {
2480  READ_LOCALS(Limit);
2481 
2482  ReadCommonPlan(&local_node->plan);
2483 
2484  READ_NODE_FIELD(limitOffset);
2485  READ_NODE_FIELD(limitCount);
2486  READ_ENUM_FIELD(limitOption, LimitOption);
2487  READ_INT_FIELD(uniqNumCols);
2488  READ_ATTRNUMBER_ARRAY(uniqColIdx, local_node->uniqNumCols);
2489  READ_OID_ARRAY(uniqOperators, local_node->uniqNumCols);
2490  READ_OID_ARRAY(uniqCollations, local_node->uniqNumCols);
2491 
2492  READ_DONE();
2493 }
2494 
2495 /*
2496  * _readNestLoopParam
2497  */
2498 static NestLoopParam *
2500 {
2502 
2503  READ_INT_FIELD(paramno);
2504  READ_NODE_FIELD(paramval);
2505 
2506  READ_DONE();
2507 }
2508 
2509 /*
2510  * _readPlanRowMark
2511  */
2512 static PlanRowMark *
2514 {
2516 
2517  READ_UINT_FIELD(rti);
2518  READ_UINT_FIELD(prti);
2519  READ_UINT_FIELD(rowmarkId);
2520  READ_ENUM_FIELD(markType, RowMarkType);
2521  READ_INT_FIELD(allMarkTypes);
2523  READ_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2524  READ_BOOL_FIELD(isParent);
2525 
2526  READ_DONE();
2527 }
2528 
2529 static PartitionPruneInfo *
2531 {
2533 
2534  READ_NODE_FIELD(prune_infos);
2535  READ_BITMAPSET_FIELD(other_subplans);
2536 
2537  READ_DONE();
2538 }
2539 
2540 static PartitionedRelPruneInfo *
2542 {
2544 
2545  READ_UINT_FIELD(rtindex);
2546  READ_BITMAPSET_FIELD(present_parts);
2547  READ_INT_FIELD(nparts);
2548  READ_INT_ARRAY(subplan_map, local_node->nparts);
2549  READ_INT_ARRAY(subpart_map, local_node->nparts);
2550  READ_OID_ARRAY(relid_map, local_node->nparts);
2551  READ_NODE_FIELD(initial_pruning_steps);
2552  READ_NODE_FIELD(exec_pruning_steps);
2553  READ_BITMAPSET_FIELD(execparamids);
2554 
2555  READ_DONE();
2556 }
2557 
2558 static PartitionPruneStepOp *
2560 {
2562 
2563  READ_INT_FIELD(step.step_id);
2564  READ_INT_FIELD(opstrategy);
2565  READ_NODE_FIELD(exprs);
2566  READ_NODE_FIELD(cmpfns);
2567  READ_BITMAPSET_FIELD(nullkeys);
2568 
2569  READ_DONE();
2570 }
2571 
2574 {
2576 
2577  READ_INT_FIELD(step.step_id);
2579  READ_NODE_FIELD(source_stepids);
2580 
2581  READ_DONE();
2582 }
2583 
2584 /*
2585  * _readPlanInvalItem
2586  */
2587 static PlanInvalItem *
2589 {
2591 
2592  READ_INT_FIELD(cacheId);
2593  READ_UINT_FIELD(hashValue);
2594 
2595  READ_DONE();
2596 }
2597 
2598 /*
2599  * _readSubPlan
2600  */
2601 static SubPlan *
2603 {
2605 
2606  READ_ENUM_FIELD(subLinkType, SubLinkType);
2607  READ_NODE_FIELD(testexpr);
2608  READ_NODE_FIELD(paramIds);
2609  READ_INT_FIELD(plan_id);
2610  READ_STRING_FIELD(plan_name);
2611  READ_OID_FIELD(firstColType);
2612  READ_INT_FIELD(firstColTypmod);
2613  READ_OID_FIELD(firstColCollation);
2614  READ_BOOL_FIELD(useHashTable);
2615  READ_BOOL_FIELD(unknownEqFalse);
2616  READ_BOOL_FIELD(parallel_safe);
2617  READ_NODE_FIELD(setParam);
2618  READ_NODE_FIELD(parParam);
2620  READ_FLOAT_FIELD(startup_cost);
2621  READ_FLOAT_FIELD(per_call_cost);
2622 
2623  READ_DONE();
2624 }
2625 
2626 /*
2627  * _readAlternativeSubPlan
2628  */
2629 static AlternativeSubPlan *
2631 {
2633 
2634  READ_NODE_FIELD(subplans);
2635 
2636  READ_DONE();
2637 }
2638 
2639 /*
2640  * _readExtensibleNode
2641  */
2642 static ExtensibleNode *
2644 {
2645  const ExtensibleNodeMethods *methods;
2646  ExtensibleNode *local_node;
2647  const char *extnodename;
2648 
2649  READ_TEMP_LOCALS();
2650 
2651  token = pg_strtok(&length); /* skip :extnodename */
2652  token = pg_strtok(&length); /* get extnodename */
2653 
2654  extnodename = nullable_string(token, length);
2655  if (!extnodename)
2656  elog(ERROR, "extnodename has to be supplied");
2657  methods = GetExtensibleNodeMethods(extnodename, false);
2658 
2659  local_node = (ExtensibleNode *) newNode(methods->node_size,
2661  local_node->extnodename = extnodename;
2662 
2663  /* deserialize the private fields */
2664  methods->nodeRead(local_node);
2665 
2666  READ_DONE();
2667 }
2668 
2669 /*
2670  * _readPartitionBoundSpec
2671  */
2672 static PartitionBoundSpec *
2674 {
2676 
2677  READ_CHAR_FIELD(strategy);
2678  READ_BOOL_FIELD(is_default);
2679  READ_INT_FIELD(modulus);
2680  READ_INT_FIELD(remainder);
2681  READ_NODE_FIELD(listdatums);
2682  READ_NODE_FIELD(lowerdatums);
2683  READ_NODE_FIELD(upperdatums);
2684  READ_LOCATION_FIELD(location);
2685 
2686  READ_DONE();
2687 }
2688 
2689 /*
2690  * _readPartitionRangeDatum
2691  */
2692 static PartitionRangeDatum *
2694 {
2696 
2699  READ_LOCATION_FIELD(location);
2700 
2701  READ_DONE();
2702 }
2703 
2704 /*
2705  * parseNodeString
2706  *
2707  * Given a character string representing a node tree, parseNodeString creates
2708  * the internal node structure.
2709  *
2710  * The string to be read must already have been loaded into pg_strtok().
2711  */
2712 Node *
2714 {
2715  void *return_value;
2716 
2717  READ_TEMP_LOCALS();
2718 
2719  /* Guard against stack overflow due to overly complex expressions */
2721 
2722  token = pg_strtok(&length);
2723 
2724 #define MATCH(tokname, namelen) \
2725  (length == namelen && memcmp(token, tokname, namelen) == 0)
2726 
2727  if (MATCH("QUERY", 5))
2728  return_value = _readQuery();
2729  else if (MATCH("WITHCHECKOPTION", 15))
2730  return_value = _readWithCheckOption();
2731  else if (MATCH("SORTGROUPCLAUSE", 15))
2732  return_value = _readSortGroupClause();
2733  else if (MATCH("GROUPINGSET", 11))
2734  return_value = _readGroupingSet();
2735  else if (MATCH("WINDOWCLAUSE", 12))
2736  return_value = _readWindowClause();
2737  else if (MATCH("ROWMARKCLAUSE", 13))
2738  return_value = _readRowMarkClause();
2739  else if (MATCH("CTESEARCHCLAUSE", 15))
2740  return_value = _readCTESearchClause();
2741  else if (MATCH("CTECYCLECLAUSE", 14))
2742  return_value = _readCTECycleClause();
2743  else if (MATCH("COMMONTABLEEXPR", 15))
2744  return_value = _readCommonTableExpr();
2745  else if (MATCH("SETOPERATIONSTMT", 16))
2746  return_value = _readSetOperationStmt();
2747  else if (MATCH("ALIAS", 5))
2748  return_value = _readAlias();
2749  else if (MATCH("RANGEVAR", 8))
2750  return_value = _readRangeVar();
2751  else if (MATCH("INTOCLAUSE", 10))
2752  return_value = _readIntoClause();
2753  else if (MATCH("TABLEFUNC", 9))
2754  return_value = _readTableFunc();
2755  else if (MATCH("VAR", 3))
2756  return_value = _readVar();
2757  else if (MATCH("CONST", 5))
2758  return_value = _readConst();
2759  else if (MATCH("PARAM", 5))
2760  return_value = _readParam();
2761  else if (MATCH("AGGREF", 6))
2762  return_value = _readAggref();
2763  else if (MATCH("GROUPINGFUNC", 12))
2764  return_value = _readGroupingFunc();
2765  else if (MATCH("WINDOWFUNC", 10))
2766  return_value = _readWindowFunc();
2767  else if (MATCH("SUBSCRIPTINGREF", 15))
2768  return_value = _readSubscriptingRef();
2769  else if (MATCH("FUNCEXPR", 8))
2770  return_value = _readFuncExpr();
2771  else if (MATCH("NAMEDARGEXPR", 12))
2772  return_value = _readNamedArgExpr();
2773  else if (MATCH("OPEXPR", 6))
2774  return_value = _readOpExpr();
2775  else if (MATCH("DISTINCTEXPR", 12))
2776  return_value = _readDistinctExpr();
2777  else if (MATCH("NULLIFEXPR", 10))
2778  return_value = _readNullIfExpr();
2779  else if (MATCH("SCALARARRAYOPEXPR", 17))
2780  return_value = _readScalarArrayOpExpr();
2781  else if (MATCH("BOOLEXPR", 8))
2782  return_value = _readBoolExpr();
2783  else if (MATCH("SUBLINK", 7))
2784  return_value = _readSubLink();
2785  else if (MATCH("FIELDSELECT", 11))
2786  return_value = _readFieldSelect();
2787  else if (MATCH("FIELDSTORE", 10))
2788  return_value = _readFieldStore();
2789  else if (MATCH("RELABELTYPE", 11))
2790  return_value = _readRelabelType();
2791  else if (MATCH("COERCEVIAIO", 11))
2792  return_value = _readCoerceViaIO();
2793  else if (MATCH("ARRAYCOERCEEXPR", 15))
2794  return_value = _readArrayCoerceExpr();
2795  else if (MATCH("CONVERTROWTYPEEXPR", 18))
2796  return_value = _readConvertRowtypeExpr();
2797  else if (MATCH("COLLATE", 7))
2798  return_value = _readCollateExpr();
2799  else if (MATCH("CASE", 4))
2800  return_value = _readCaseExpr();
2801  else if (MATCH("WHEN", 4))
2802  return_value = _readCaseWhen();
2803  else if (MATCH("CASETESTEXPR", 12))
2804  return_value = _readCaseTestExpr();
2805  else if (MATCH("ARRAY", 5))
2806  return_value = _readArrayExpr();
2807  else if (MATCH("ROW", 3))
2808  return_value = _readRowExpr();
2809  else if (MATCH("ROWCOMPARE", 10))
2810  return_value = _readRowCompareExpr();
2811  else if (MATCH("COALESCE", 8))
2812  return_value = _readCoalesceExpr();
2813  else if (MATCH("MINMAX", 6))
2814  return_value = _readMinMaxExpr();
2815  else if (MATCH("SQLVALUEFUNCTION", 16))
2816  return_value = _readSQLValueFunction();
2817  else if (MATCH("XMLEXPR", 7))
2818  return_value = _readXmlExpr();
2819  else if (MATCH("NULLTEST", 8))
2820  return_value = _readNullTest();
2821  else if (MATCH("BOOLEANTEST", 11))
2822  return_value = _readBooleanTest();
2823  else if (MATCH("COERCETODOMAIN", 14))
2824  return_value = _readCoerceToDomain();
2825  else if (MATCH("COERCETODOMAINVALUE", 19))
2826  return_value = _readCoerceToDomainValue();
2827  else if (MATCH("SETTODEFAULT", 12))
2828  return_value = _readSetToDefault();
2829  else if (MATCH("CURRENTOFEXPR", 13))
2830  return_value = _readCurrentOfExpr();
2831  else if (MATCH("NEXTVALUEEXPR", 13))
2832  return_value = _readNextValueExpr();
2833  else if (MATCH("INFERENCEELEM", 13))
2834  return_value = _readInferenceElem();
2835  else if (MATCH("TARGETENTRY", 11))
2836  return_value = _readTargetEntry();
2837  else if (MATCH("RANGETBLREF", 11))
2838  return_value = _readRangeTblRef();
2839  else if (MATCH("JOINEXPR", 8))
2840  return_value = _readJoinExpr();
2841  else if (MATCH("FROMEXPR", 8))
2842  return_value = _readFromExpr();
2843  else if (MATCH("ONCONFLICTEXPR", 14))
2844  return_value = _readOnConflictExpr();
2845  else if (MATCH("APPENDRELINFO", 13))
2846  return_value = _readAppendRelInfo();
2847  else if (MATCH("RTE", 3))
2848  return_value = _readRangeTblEntry();
2849  else if (MATCH("RANGETBLFUNCTION", 16))
2850  return_value = _readRangeTblFunction();
2851  else if (MATCH("TABLESAMPLECLAUSE", 17))
2852  return_value = _readTableSampleClause();
2853  else if (MATCH("NOTIFY", 6))
2854  return_value = _readNotifyStmt();
2855  else if (MATCH("DEFELEM", 7))
2856  return_value = _readDefElem();
2857  else if (MATCH("DECLARECURSOR", 13))
2858  return_value = _readDeclareCursorStmt();
2859  else if (MATCH("PLANNEDSTMT", 11))
2860  return_value = _readPlannedStmt();
2861  else if (MATCH("PLAN", 4))
2862  return_value = _readPlan();
2863  else if (MATCH("RESULT", 6))
2864  return_value = _readResult();
2865  else if (MATCH("PROJECTSET", 10))
2866  return_value = _readProjectSet();
2867  else if (MATCH("MODIFYTABLE", 11))
2868  return_value = _readModifyTable();
2869  else if (MATCH("APPEND", 6))
2870  return_value = _readAppend();
2871  else if (MATCH("MERGEAPPEND", 11))
2872  return_value = _readMergeAppend();
2873  else if (MATCH("RECURSIVEUNION", 14))
2874  return_value = _readRecursiveUnion();
2875  else if (MATCH("BITMAPAND", 9))
2876  return_value = _readBitmapAnd();
2877  else if (MATCH("BITMAPOR", 8))
2878  return_value = _readBitmapOr();
2879  else if (MATCH("SCAN", 4))
2880  return_value = _readScan();
2881  else if (MATCH("SEQSCAN", 7))
2882  return_value = _readSeqScan();
2883  else if (MATCH("SAMPLESCAN", 10))
2884  return_value = _readSampleScan();
2885  else if (MATCH("INDEXSCAN", 9))
2886  return_value = _readIndexScan();
2887  else if (MATCH("INDEXONLYSCAN", 13))
2888  return_value = _readIndexOnlyScan();
2889  else if (MATCH("BITMAPINDEXSCAN", 15))
2890  return_value = _readBitmapIndexScan();
2891  else if (MATCH("BITMAPHEAPSCAN", 14))
2892  return_value = _readBitmapHeapScan();
2893  else if (MATCH("TIDSCAN", 7))
2894  return_value = _readTidScan();
2895  else if (MATCH("TIDRANGESCAN", 12))
2896  return_value = _readTidRangeScan();
2897  else if (MATCH("SUBQUERYSCAN", 12))
2898  return_value = _readSubqueryScan();
2899  else if (MATCH("FUNCTIONSCAN", 12))
2900  return_value = _readFunctionScan();
2901  else if (MATCH("VALUESSCAN", 10))
2902  return_value = _readValuesScan();
2903  else if (MATCH("TABLEFUNCSCAN", 13))
2904  return_value = _readTableFuncScan();
2905  else if (MATCH("CTESCAN", 7))
2906  return_value = _readCteScan();
2907  else if (MATCH("NAMEDTUPLESTORESCAN", 19))
2908  return_value = _readNamedTuplestoreScan();
2909  else if (MATCH("WORKTABLESCAN", 13))
2910  return_value = _readWorkTableScan();
2911  else if (MATCH("FOREIGNSCAN", 11))
2912  return_value = _readForeignScan();
2913  else if (MATCH("CUSTOMSCAN", 10))
2914  return_value = _readCustomScan();
2915  else if (MATCH("JOIN", 4))
2916  return_value = _readJoin();
2917  else if (MATCH("NESTLOOP", 8))
2918  return_value = _readNestLoop();
2919  else if (MATCH("MERGEJOIN", 9))
2920  return_value = _readMergeJoin();
2921  else if (MATCH("HASHJOIN", 8))
2922  return_value = _readHashJoin();
2923  else if (MATCH("MATERIAL", 8))
2924  return_value = _readMaterial();
2925  else if (MATCH("RESULTCACHE", 11))
2926  return_value = _readResultCache();
2927  else if (MATCH("SORT", 4))
2928  return_value = _readSort();
2929  else if (MATCH("INCREMENTALSORT", 15))
2930  return_value = _readIncrementalSort();
2931  else if (MATCH("GROUP", 5))
2932  return_value = _readGroup();
2933  else if (MATCH("AGG", 3))
2934  return_value = _readAgg();
2935  else if (MATCH("WINDOWAGG", 9))
2936  return_value = _readWindowAgg();
2937  else if (MATCH("UNIQUE", 6))
2938  return_value = _readUnique();
2939  else if (MATCH("GATHER", 6))
2940  return_value = _readGather();
2941  else if (MATCH("GATHERMERGE", 11))
2942  return_value = _readGatherMerge();
2943  else if (MATCH("HASH", 4))
2944  return_value = _readHash();
2945  else if (MATCH("SETOP", 5))
2946  return_value = _readSetOp();
2947  else if (MATCH("LOCKROWS", 8))
2948  return_value = _readLockRows();
2949  else if (MATCH("LIMIT", 5))
2950  return_value = _readLimit();
2951  else if (MATCH("NESTLOOPPARAM", 13))
2952  return_value = _readNestLoopParam();
2953  else if (MATCH("PLANROWMARK", 11))
2954  return_value = _readPlanRowMark();
2955  else if (MATCH("PARTITIONPRUNEINFO", 18))
2956  return_value = _readPartitionPruneInfo();
2957  else if (MATCH("PARTITIONEDRELPRUNEINFO", 23))
2958  return_value = _readPartitionedRelPruneInfo();
2959  else if (MATCH("PARTITIONPRUNESTEPOP", 20))
2960  return_value = _readPartitionPruneStepOp();
2961  else if (MATCH("PARTITIONPRUNESTEPCOMBINE", 25))
2962  return_value = _readPartitionPruneStepCombine();
2963  else if (MATCH("PLANINVALITEM", 13))
2964  return_value = _readPlanInvalItem();
2965  else if (MATCH("SUBPLAN", 7))
2966  return_value = _readSubPlan();
2967  else if (MATCH("ALTERNATIVESUBPLAN", 18))
2968  return_value = _readAlternativeSubPlan();
2969  else if (MATCH("EXTENSIBLENODE", 14))
2970  return_value = _readExtensibleNode();
2971  else if (MATCH("PARTITIONBOUNDSPEC", 18))
2972  return_value = _readPartitionBoundSpec();
2973  else if (MATCH("PARTITIONRANGEDATUM", 19))
2974  return_value = _readPartitionRangeDatum();
2975  else
2976  {
2977  elog(ERROR, "badly formatted node string \"%.32s\"...", token);
2978  return_value = NULL; /* keep compiler quiet */
2979  }
2980 
2981  return (Node *) return_value;
2982 }
2983 
2984 
2985 /*
2986  * readDatum
2987  *
2988  * Given a string representation of a constant, recreate the appropriate
2989  * Datum. The string representation embeds length info, but not byValue,
2990  * so we must be told that.
2991  */
2992 Datum
2993 readDatum(bool typbyval)
2994 {
2995  Size length,
2996  i;
2997  int tokenLength;
2998  const char *token;
2999  Datum res;
3000  char *s;
3001 
3002  /*
3003  * read the actual length of the value
3004  */
3005  token = pg_strtok(&tokenLength);
3006  length = atoui(token);
3007 
3008  token = pg_strtok(&tokenLength); /* read the '[' */
3009  if (token == NULL || token[0] != '[')
3010  elog(ERROR, "expected \"[\" to start datum, but got \"%s\"; length = %zu",
3011  token ? token : "[NULL]", length);
3012 
3013  if (typbyval)
3014  {
3015  if (length > (Size) sizeof(Datum))
3016  elog(ERROR, "byval datum but length = %zu", length);
3017  res = (Datum) 0;
3018  s = (char *) (&res);
3019  for (i = 0; i < (Size) sizeof(Datum); i++)
3020  {
3021  token = pg_strtok(&tokenLength);
3022  s[i] = (char) atoi(token);
3023  }
3024  }
3025  else if (length <= 0)
3026  res = (Datum) NULL;
3027  else
3028  {
3029  s = (char *) palloc(length);
3030  for (i = 0; i < length; i++)
3031  {
3032  token = pg_strtok(&tokenLength);
3033  s[i] = (char) atoi(token);
3034  }
3035  res = PointerGetDatum(s);
3036  }
3037 
3038  token = pg_strtok(&tokenLength); /* read the ']' */
3039  if (token == NULL || token[0] != ']')
3040  elog(ERROR, "expected \"]\" to end datum, but got \"%s\"; length = %zu",
3041  token ? token : "[NULL]", length);
3042 
3043  return res;
3044 }
3045 
3046 /*
3047  * readAttrNumberCols
3048  */
3049 AttrNumber *
3051 {
3052  int tokenLength,
3053  i;
3054  const char *token;
3055  AttrNumber *attr_vals;
3056 
3057  if (numCols <= 0)
3058  return NULL;
3059 
3060  attr_vals = (AttrNumber *) palloc(numCols * sizeof(AttrNumber));
3061  for (i = 0; i < numCols; i++)
3062  {
3063  token = pg_strtok(&tokenLength);
3064  attr_vals[i] = atoi(token);
3065  }
3066 
3067  return attr_vals;
3068 }
3069 
3070 /*
3071  * readOidCols
3072  */
3073 Oid *
3074 readOidCols(int numCols)
3075 {
3076  int tokenLength,
3077  i;
3078  const char *token;
3079  Oid *oid_vals;
3080 
3081  if (numCols <= 0)
3082  return NULL;
3083 
3084  oid_vals = (Oid *) palloc(numCols * sizeof(Oid));
3085  for (i = 0; i < numCols; i++)
3086  {
3087  token = pg_strtok(&tokenLength);
3088  oid_vals[i] = atooid(token);
3089  }
3090 
3091  return oid_vals;
3092 }
3093 
3094 /*
3095  * readIntCols
3096  */
3097 int *
3098 readIntCols(int numCols)
3099 {
3100  int tokenLength,
3101  i;
3102  const char *token;
3103  int *int_vals;
3104 
3105  if (numCols <= 0)
3106  return NULL;
3107 
3108  int_vals = (int *) palloc(numCols * sizeof(int));
3109  for (i = 0; i < numCols; i++)
3110  {
3111  token = pg_strtok(&tokenLength);
3112  int_vals[i] = atoi(token);
3113  }
3114 
3115  return int_vals;
3116 }
3117 
3118 /*
3119  * readBoolCols
3120  */
3121 bool *
3122 readBoolCols(int numCols)
3123 {
3124  int tokenLength,
3125  i;
3126  const char *token;
3127  bool *bool_vals;
3128 
3129  if (numCols <= 0)
3130  return NULL;
3131 
3132  bool_vals = (bool *) palloc(numCols * sizeof(bool));
3133  for (i = 0; i < numCols; i++)
3134  {
3135  token = pg_strtok(&tokenLength);
3136  bool_vals[i] = strtobool(token);
3137  }
3138 
3139  return bool_vals;
3140 }
static NullTest * _readNullTest(void)
Definition: readfuncs.c:1185
static JoinExpr * _readJoinExpr(void)
Definition: readfuncs.c:1342
static RangeVar * _readRangeVar(void)
Definition: readfuncs.c:514
#define atoui(x)
Definition: readfuncs.c:185
static RangeTblEntry * _readRangeTblEntry(void)
Definition: readfuncs.c:1428
static DefElem * _readDefElem(void)
Definition: readfuncs.c:1556
static RowExpr * _readRowExpr(void)
Definition: readfuncs.c:1079
static MergeJoin * _readMergeJoin(void)
Definition: readfuncs.c:2165
static MinMaxExpr * _readMinMaxExpr(void)
Definition: readfuncs.c:1130
static RowMarkClause * _readRowMarkClause(void)
Definition: readfuncs.c:402
static FuncExpr * _readFuncExpr(void)
Definition: readfuncs.c:731
Plan plan
Definition: plannodes.h:343
#define READ_BOOL_ARRAY(fldname, len)
Definition: readfuncs.c:170
static Hash * _readHash(void)
Definition: readfuncs.c:2420
PartitionPruneCombineOp
Definition: plannodes.h:1261
static Result * _readResult(void)
Definition: readfuncs.c:1650
static Query * _readQuery(void)
Definition: readfuncs.c:247
static RowCompareExpr * _readRowCompareExpr(void)
Definition: readfuncs.c:1096
static Param * _readParam(void)
Definition: readfuncs.c:622
static PlanInvalItem * _readPlanInvalItem(void)
Definition: readfuncs.c:2588
static PartitionPruneInfo * _readPartitionPruneInfo(void)
Definition: readfuncs.c:2530
ParamKind
Definition: primnodes.h:256
static AppendRelInfo * _readAppendRelInfo(void)
Definition: readfuncs.c:1404
static WindowAgg * _readWindowAgg(void)
Definition: readfuncs.c:2330
static struct @142 value
static IndexScan * _readIndexScan(void)
Definition: readfuncs.c:1859
static NotifyStmt * _readNotifyStmt(void)
Definition: readfuncs.c:298
static Scan * _readScan(void)
Definition: readfuncs.c:1818
static NamedArgExpr * _readNamedArgExpr(void)
Definition: readfuncs.c:752
Plan plan
Definition: plannodes.h:810
List * coltypmods
Definition: primnodes.h:91
static LockRows * _readLockRows(void)
Definition: readfuncs.c:2462
static CurrentOfExpr * _readCurrentOfExpr(void)
Definition: readfuncs.c:1266
PartitionRangeDatumKind
Definition: parsenodes.h:850
#define READ_LONG_FIELD(fldname)
Definition: readfuncs.c:86
#define PointerGetDatum(X)
Definition: postgres.h:600
static CollateExpr * _readCollateExpr(void)
Definition: readfuncs.c:998
static SubqueryScan * _readSubqueryScan(void)
Definition: readfuncs.c:1962
BoolTestType
Definition: primnodes.h:1270
#define strtobool(x)
Definition: readfuncs.c:187
static BitmapIndexScan * _readBitmapIndexScan(void)
Definition: readfuncs.c:1899
static CaseExpr * _readCaseExpr(void)
Definition: readfuncs.c:1013
static FunctionScan * _readFunctionScan(void)
Definition: readfuncs.c:1977
static PartitionBoundSpec * _readPartitionBoundSpec(void)
Definition: readfuncs.c:2673
#define READ_BOOL_FIELD(fldname)
Definition: readfuncs.c:117
XmlExprOp
Definition: primnodes.h:1196
QuerySource
Definition: parsenodes.h:40
static void ReadCommonSort(Sort *local_node)
Definition: readfuncs.c:2242
static Unique * _readUnique(void)
Definition: readfuncs.c:2361
static MergeAppend * _readMergeAppend(void)
Definition: readfuncs.c:1731
Definition: nodes.h:539
#define READ_LOCALS_NO_FIELDS(nodeTypeName)
Definition: readfuncs.c:54
static WindowFunc * _readWindowFunc(void)
Definition: readfuncs.c:688
static WindowClause * _readWindowClause(void)
Definition: readfuncs.c:376
static OpExpr * _readOpExpr(void)
Definition: readfuncs.c:768
static IndexOnlyScan * _readIndexOnlyScan(void)
Definition: readfuncs.c:1880
static BitmapAnd * _readBitmapAnd(void)
Definition: readfuncs.c:1773
NullTestType
Definition: primnodes.h:1247
NameData relname
Definition: pg_class.h:38
unsigned int Oid
Definition: postgres_ext.h:31
Definition: primnodes.h:186
static FromExpr * _readFromExpr(void)
Definition: readfuncs.c:1363
static PartitionedRelPruneInfo * _readPartitionedRelPruneInfo(void)
Definition: readfuncs.c:2541
static Aggref * _readAggref(void)
Definition: readfuncs.c:640
SetOpStrategy
Definition: nodes.h:820
static NestLoop * _readNestLoop(void)
Definition: readfuncs.c:2150
OnCommitAction
Definition: primnodes.h:47
static ModifyTable * _readModifyTable(void)
Definition: readfuncs.c:1678
List * colcollations
Definition: primnodes.h:92
static NextValueExpr * _readNextValueExpr(void)
Definition: readfuncs.c:1281
JoinType
Definition: nodes.h:706
static DistinctExpr * _readDistinctExpr(void)
Definition: readfuncs.c:788
Oid * readOidCols(int numCols)
Definition: readfuncs.c:3074
static ArrayCoerceExpr * _readArrayCoerceExpr(void)
Definition: readfuncs.c:963
static TidRangeScan * _readTidRangeScan(void)
Definition: readfuncs.c:1947
static TargetEntry * _readTargetEntry(void)
Definition: readfuncs.c:1310
#define newNode(size, tag)
Definition: nodes.h:577
static void ReadCommonPlan(Plan *local_node)
Definition: readfuncs.c:1612
static Agg * _readAgg(void)
Definition: readfuncs.c:2305
static SeqScan * _readSeqScan(void)
Definition: readfuncs.c:1831
MinMaxOp
Definition: primnodes.h:1129
SetOperation
Definition: parsenodes.h:1631
bool * readBoolCols(int numCols)
Definition: readfuncs.c:3122
static AlternativeSubPlan * _readAlternativeSubPlan(void)
Definition: readfuncs.c:2630
static CteScan * _readCteScan(void)
Definition: readfuncs.c:2023
static GroupingFunc * _readGroupingFunc(void)
Definition: readfuncs.c:671
#define ERROR
Definition: elog.h:46
static CoerceToDomain * _readCoerceToDomain(void)
Definition: readfuncs.c:1216
CTEMaterialize
Definition: parsenodes.h:1465
static SubLink * _readSubLink(void)
Definition: readfuncs.c:873
static HashJoin * _readHashJoin(void)
Definition: readfuncs.c:2190
#define READ_FLOAT_FIELD(fldname)
Definition: readfuncs.c:111
static PartitionPruneStepCombine * _readPartitionPruneStepCombine(void)
Definition: readfuncs.c:2573
static ValuesScan * _readValuesScan(void)
Definition: readfuncs.c:1993
static ConvertRowtypeExpr * _readConvertRowtypeExpr(void)
Definition: readfuncs.c:982
#define READ_OID_ARRAY(fldname, len)
Definition: readfuncs.c:160
static OnConflictExpr * _readOnConflictExpr(void)
Definition: readfuncs.c:1377
RTEKind
Definition: parsenodes.h:976
static NullIfExpr * _readNullIfExpr(void)
Definition: readfuncs.c:808
static Append * _readAppend(void)
Definition: readfuncs.c:1712
static ExtensibleNode * _readExtensibleNode(void)
Definition: readfuncs.c:2643
static PlanRowMark * _readPlanRowMark(void)
Definition: readfuncs.c:2513
static FieldSelect * _readFieldSelect(void)
Definition: readfuncs.c:895
int * readIntCols(int numCols)
Definition: readfuncs.c:3098
void check_stack_depth(void)
Definition: postgres.c:3459
ScanDirection
Definition: sdir.h:22
static CaseWhen * _readCaseWhen(void)
Definition: readfuncs.c:1031
static SQLValueFunction * _readSQLValueFunction(void)
Definition: readfuncs.c:1148
#define READ_CHAR_FIELD(fldname)
Definition: readfuncs.c:98
static IncrementalSort * _readIncrementalSort(void)
Definition: readfuncs.c:2272
AttrNumber * readAttrNumberCols(int numCols)
Definition: readfuncs.c:3050
#define MATCH(tokname, namelen)
#define atooid(x)
Definition: postgres_ext.h:42
static ForeignScan * _readForeignScan(void)
Definition: readfuncs.c:2069
static RelabelType * _readRelabelType(void)
Definition: readfuncs.c:928
WCOKind
Definition: parsenodes.h:1204
static SetOp * _readSetOp(void)
Definition: readfuncs.c:2439
#define READ_UINT_FIELD(fldname)
Definition: readfuncs.c:74
#define READ_ENUM_FIELD(fldname, enumtype)
Definition: readfuncs.c:105
static CTESearchClause * _readCTESearchClause(void)
Definition: readfuncs.c:418
Datum readDatum(bool typbyval)
Definition: readfuncs.c:2993
SQLValueFunctionOp
Definition: primnodes.h:1157
static SortGroupClause * _readSortGroupClause(void)
Definition: readfuncs.c:344
#define READ_NODE_FIELD(fldname)
Definition: readfuncs.c:143
SubLinkType
Definition: primnodes.h:671
Bitmapset * readBitmapset(void)
Definition: readfuncs.c:238
int numCols
Definition: plannodes.h:811
static CTECycleClause * _readCTECycleClause(void)
Definition: readfuncs.c:434
static Limit * _readLimit(void)
Definition: readfuncs.c:2478
static PartitionRangeDatum * _readPartitionRangeDatum(void)
Definition: readfuncs.c:2693
LockClauseStrength
Definition: lockoptions.h:21
static void ReadCommonScan(Scan *local_node)
Definition: readfuncs.c:1805
uintptr_t Datum
Definition: postgres.h:411
static void ReadCommonJoin(Join *local_node)
Definition: readfuncs.c:2122
static GatherMerge * _readGatherMerge(void)
Definition: readfuncs.c:2398
static DeclareCursorStmt * _readDeclareCursorStmt(void)
Definition: readfuncs.c:312
static Gather * _readGather(void)
Definition: readfuncs.c:2379
#define READ_TEMP_LOCALS()
Definition: readfuncs.c:58
List * coltypes
Definition: primnodes.h:90
#define READ_UINT64_FIELD(fldname)
Definition: readfuncs.c:80
const char * extnodename
Definition: extensible.h:35
static Var * _readVar(void)
Definition: readfuncs.c:576
#define READ_LOCATION_FIELD(fldname)
Definition: readfuncs.c:135
RowCompareType
Definition: primnodes.h:1092
static SampleScan * _readSampleScan(void)
Definition: readfuncs.c:1844
static SubPlan * _readSubPlan(void)
Definition: readfuncs.c:2602
#define READ_LOCALS(nodeTypeName)
Definition: readfuncs.c:63
static TidScan * _readTidScan(void)
Definition: readfuncs.c:1932
static CoerceToDomainValue * _readCoerceToDomainValue(void)
Definition: readfuncs.c:1234
static TableFuncScan * _readTableFuncScan(void)
Definition: readfuncs.c:2008
static IntoClause * _readIntoClause(void)
Definition: readfuncs.c:556
static Const * _readConst(void)
Definition: readfuncs.c:597
static SetOperationStmt * _readSetOperationStmt(void)
Definition: readfuncs.c:481
static PlannedStmt * _readPlannedStmt(void)
Definition: readfuncs.c:1577
static NamedTuplestoreScan * _readNamedTuplestoreScan(void)
Definition: readfuncs.c:2039
XmlOptionType
Definition: primnodes.h:1208
void(* nodeRead)(struct ExtensibleNode *node)
Definition: extensible.h:70
size_t Size
Definition: c.h:540
static Material * _readMaterial(void)
Definition: readfuncs.c:2208
AggSplit
Definition: nodes.h:790
#define READ_OID_FIELD(fldname)
Definition: readfuncs.c:92
static int list_length(const List *l)
Definition: pg_list.h:149
static CaseTestExpr * _readCaseTestExpr(void)
Definition: readfuncs.c:1046
RowMarkType
Definition: plannodes.h:1064
static Alias * _readAlias(void)
Definition: readfuncs.c:503
static BitmapOr * _readBitmapOr(void)
Definition: readfuncs.c:1788
static const struct fns functions
Definition: regcomp.c:313
static RangeTblRef * _readRangeTblRef(void)
Definition: readfuncs.c:1329
static RecursiveUnion * _readRecursiveUnion(void)
Definition: readfuncs.c:1753
Bitmapset * bms_add_member(Bitmapset *a, int x)
Definition: bitmapset.c:736
static FieldStore * _readFieldStore(void)
Definition: readfuncs.c:912
static CoalesceExpr * _readCoalesceExpr(void)
Definition: readfuncs.c:1114
LimitOption
Definition: nodes.h:845
const char * name
Definition: encode.c:515
#define READ_BITMAPSET_FIELD(fldname)
Definition: readfuncs.c:149
Node * parseNodeString(void)
Definition: readfuncs.c:2713
static SetToDefault * _readSetToDefault(void)
Definition: readfuncs.c:1250
static WithCheckOption * _readWithCheckOption(void)
Definition: readfuncs.c:327
static PartitionPruneStepOp * _readPartitionPruneStepOp(void)
Definition: readfuncs.c:2559
static InferenceElem * _readInferenceElem(void)
Definition: readfuncs.c:1295
static SubscriptingRef * _readSubscriptingRef(void)
Definition: readfuncs.c:710
AggStrategy
Definition: nodes.h:768
static ScalarArrayOpExpr * _readScalarArrayOpExpr(void)
Definition: readfuncs.c:828
void * palloc(Size size)
Definition: mcxt.c:1062
int xmloption
Definition: xml.c:98
SetOpCmd
Definition: nodes.h:812
#define elog(elevel,...)
Definition: elog.h:232
int i
static BoolExpr * _readBoolExpr(void)
Definition: readfuncs.c:847
static CustomScan * _readCustomScan(void)
Definition: readfuncs.c:2092
DefElemAction
Definition: parsenodes.h:734
void * arg
static CommonTableExpr * _readCommonTableExpr(void)
Definition: readfuncs.c:456
static ArrayExpr * _readArrayExpr(void)
Definition: readfuncs.c:1061
GroupingSetKind
Definition: parsenodes.h:1340
const char * pg_strtok(int *length)
Definition: read.c:152
#define READ_STRING_FIELD(fldname)
Definition: readfuncs.c:123
#define READ_DONE()
Definition: readfuncs.c:175
static ResultCache * _readResultCache(void)
Definition: readfuncs.c:2221
#define READ_INT_FIELD(fldname)
Definition: readfuncs.c:68
Definition: plannodes.h:857
static RangeTblFunction * _readRangeTblFunction(void)
Definition: readfuncs.c:1522
static BooleanTest * _readBooleanTest(void)
Definition: readfuncs.c:1201
static Plan * _readPlan(void)
Definition: readfuncs.c:1637
static XmlExpr * _readXmlExpr(void)
Definition: readfuncs.c:1164
#define READ_ATTRNUMBER_ARRAY(fldname, len)
Definition: readfuncs.c:155
CoercionForm
Definition: primnodes.h:481
static TableFunc * _readTableFunc(void)
Definition: readfuncs.c:534
#define READ_INT_ARRAY(fldname, len)
Definition: readfuncs.c:165
const CustomScanMethods * GetCustomScanMethods(const char *CustomName, bool missing_ok)
Definition: extensible.c:137
static TableSampleClause * _readTableSampleClause(void)
Definition: readfuncs.c:1541
static NestLoopParam * _readNestLoopParam(void)
Definition: readfuncs.c:2499
static ProjectSet * _readProjectSet(void)
Definition: readfuncs.c:1665
OnConflictAction
Definition: nodes.h:832
static BitmapHeapScan * _readBitmapHeapScan(void)
Definition: readfuncs.c:1917
int16 AttrNumber
Definition: attnum.h:21
LockWaitPolicy
Definition: lockoptions.h:36
long val
Definition: informix.c:664
static Bitmapset * _readBitmapset(void)
Definition: readfuncs.c:197
CmdType
Definition: nodes.h:682
static Join * _readJoin(void)
Definition: readfuncs.c:2137
static Sort * _readSort(void)
Definition: readfuncs.c:2259
static CoerceViaIO * _readCoerceViaIO(void)
Definition: readfuncs.c:946
static Group * _readGroup(void)
Definition: readfuncs.c:2287
static GroupingSet * _readGroupingSet(void)
Definition: readfuncs.c:361
static WorkTableScan * _readWorkTableScan(void)
Definition: readfuncs.c:2054
const ExtensibleNodeMethods * GetExtensibleNodeMethods(const char *extnodename, bool missing_ok)
Definition: extensible.c:125
#define nullable_string(token, length)
Definition: readfuncs.c:189
Plan plan
Definition: plannodes.h:703
OverridingKind
Definition: parsenodes.h:32