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_OID_FIELD(negfuncid);
836  READ_BOOL_FIELD(useOr);
837  READ_OID_FIELD(inputcollid);
839  READ_LOCATION_FIELD(location);
840 
841  READ_DONE();
842 }
843 
844 /*
845  * _readBoolExpr
846  */
847 static BoolExpr *
849 {
851 
852  /* do-it-yourself enum representation */
853  token = pg_strtok(&length); /* skip :boolop */
854  token = pg_strtok(&length); /* get field value */
855  if (strncmp(token, "and", 3) == 0)
856  local_node->boolop = AND_EXPR;
857  else if (strncmp(token, "or", 2) == 0)
858  local_node->boolop = OR_EXPR;
859  else if (strncmp(token, "not", 3) == 0)
860  local_node->boolop = NOT_EXPR;
861  else
862  elog(ERROR, "unrecognized boolop \"%.*s\"", length, token);
863 
865  READ_LOCATION_FIELD(location);
866 
867  READ_DONE();
868 }
869 
870 /*
871  * _readSubLink
872  */
873 static SubLink *
875 {
877 
878  READ_ENUM_FIELD(subLinkType, SubLinkType);
879  READ_INT_FIELD(subLinkId);
880  READ_NODE_FIELD(testexpr);
881  READ_NODE_FIELD(operName);
882  READ_NODE_FIELD(subselect);
883  READ_LOCATION_FIELD(location);
884 
885  READ_DONE();
886 }
887 
888 /*
889  * _readSubPlan is not needed since it doesn't appear in stored rules.
890  */
891 
892 /*
893  * _readFieldSelect
894  */
895 static FieldSelect *
897 {
899 
901  READ_INT_FIELD(fieldnum);
902  READ_OID_FIELD(resulttype);
903  READ_INT_FIELD(resulttypmod);
904  READ_OID_FIELD(resultcollid);
905 
906  READ_DONE();
907 }
908 
909 /*
910  * _readFieldStore
911  */
912 static FieldStore *
914 {
916 
918  READ_NODE_FIELD(newvals);
919  READ_NODE_FIELD(fieldnums);
920  READ_OID_FIELD(resulttype);
921 
922  READ_DONE();
923 }
924 
925 /*
926  * _readRelabelType
927  */
928 static RelabelType *
930 {
932 
934  READ_OID_FIELD(resulttype);
935  READ_INT_FIELD(resulttypmod);
936  READ_OID_FIELD(resultcollid);
937  READ_ENUM_FIELD(relabelformat, CoercionForm);
938  READ_LOCATION_FIELD(location);
939 
940  READ_DONE();
941 }
942 
943 /*
944  * _readCoerceViaIO
945  */
946 static CoerceViaIO *
948 {
950 
952  READ_OID_FIELD(resulttype);
953  READ_OID_FIELD(resultcollid);
954  READ_ENUM_FIELD(coerceformat, CoercionForm);
955  READ_LOCATION_FIELD(location);
956 
957  READ_DONE();
958 }
959 
960 /*
961  * _readArrayCoerceExpr
962  */
963 static ArrayCoerceExpr *
965 {
967 
969  READ_NODE_FIELD(elemexpr);
970  READ_OID_FIELD(resulttype);
971  READ_INT_FIELD(resulttypmod);
972  READ_OID_FIELD(resultcollid);
973  READ_ENUM_FIELD(coerceformat, CoercionForm);
974  READ_LOCATION_FIELD(location);
975 
976  READ_DONE();
977 }
978 
979 /*
980  * _readConvertRowtypeExpr
981  */
982 static ConvertRowtypeExpr *
984 {
986 
988  READ_OID_FIELD(resulttype);
989  READ_ENUM_FIELD(convertformat, CoercionForm);
990  READ_LOCATION_FIELD(location);
991 
992  READ_DONE();
993 }
994 
995 /*
996  * _readCollateExpr
997  */
998 static CollateExpr *
1000 {
1002 
1004  READ_OID_FIELD(collOid);
1005  READ_LOCATION_FIELD(location);
1006 
1007  READ_DONE();
1008 }
1009 
1010 /*
1011  * _readCaseExpr
1012  */
1013 static CaseExpr *
1015 {
1017 
1018  READ_OID_FIELD(casetype);
1019  READ_OID_FIELD(casecollid);
1022  READ_NODE_FIELD(defresult);
1023  READ_LOCATION_FIELD(location);
1024 
1025  READ_DONE();
1026 }
1027 
1028 /*
1029  * _readCaseWhen
1030  */
1031 static CaseWhen *
1033 {
1035 
1036  READ_NODE_FIELD(expr);
1037  READ_NODE_FIELD(result);
1038  READ_LOCATION_FIELD(location);
1039 
1040  READ_DONE();
1041 }
1042 
1043 /*
1044  * _readCaseTestExpr
1045  */
1046 static CaseTestExpr *
1048 {
1050 
1051  READ_OID_FIELD(typeId);
1052  READ_INT_FIELD(typeMod);
1053  READ_OID_FIELD(collation);
1054 
1055  READ_DONE();
1056 }
1057 
1058 /*
1059  * _readArrayExpr
1060  */
1061 static ArrayExpr *
1063 {
1065 
1066  READ_OID_FIELD(array_typeid);
1067  READ_OID_FIELD(array_collid);
1068  READ_OID_FIELD(element_typeid);
1069  READ_NODE_FIELD(elements);
1070  READ_BOOL_FIELD(multidims);
1071  READ_LOCATION_FIELD(location);
1072 
1073  READ_DONE();
1074 }
1075 
1076 /*
1077  * _readRowExpr
1078  */
1079 static RowExpr *
1081 {
1083 
1085  READ_OID_FIELD(row_typeid);
1086  READ_ENUM_FIELD(row_format, CoercionForm);
1087  READ_NODE_FIELD(colnames);
1088  READ_LOCATION_FIELD(location);
1089 
1090  READ_DONE();
1091 }
1092 
1093 /*
1094  * _readRowCompareExpr
1095  */
1096 static RowCompareExpr *
1098 {
1100 
1102  READ_NODE_FIELD(opnos);
1103  READ_NODE_FIELD(opfamilies);
1104  READ_NODE_FIELD(inputcollids);
1105  READ_NODE_FIELD(largs);
1106  READ_NODE_FIELD(rargs);
1107 
1108  READ_DONE();
1109 }
1110 
1111 /*
1112  * _readCoalesceExpr
1113  */
1114 static CoalesceExpr *
1116 {
1118 
1119  READ_OID_FIELD(coalescetype);
1120  READ_OID_FIELD(coalescecollid);
1122  READ_LOCATION_FIELD(location);
1123 
1124  READ_DONE();
1125 }
1126 
1127 /*
1128  * _readMinMaxExpr
1129  */
1130 static MinMaxExpr *
1132 {
1134 
1135  READ_OID_FIELD(minmaxtype);
1136  READ_OID_FIELD(minmaxcollid);
1137  READ_OID_FIELD(inputcollid);
1140  READ_LOCATION_FIELD(location);
1141 
1142  READ_DONE();
1143 }
1144 
1145 /*
1146  * _readSQLValueFunction
1147  */
1148 static SQLValueFunction *
1150 {
1152 
1155  READ_INT_FIELD(typmod);
1156  READ_LOCATION_FIELD(location);
1157 
1158  READ_DONE();
1159 }
1160 
1161 /*
1162  * _readXmlExpr
1163  */
1164 static XmlExpr *
1166 {
1168 
1171  READ_NODE_FIELD(named_args);
1172  READ_NODE_FIELD(arg_names);
1176  READ_INT_FIELD(typmod);
1177  READ_LOCATION_FIELD(location);
1178 
1179  READ_DONE();
1180 }
1181 
1182 /*
1183  * _readNullTest
1184  */
1185 static NullTest *
1187 {
1189 
1191  READ_ENUM_FIELD(nulltesttype, NullTestType);
1192  READ_BOOL_FIELD(argisrow);
1193  READ_LOCATION_FIELD(location);
1194 
1195  READ_DONE();
1196 }
1197 
1198 /*
1199  * _readBooleanTest
1200  */
1201 static BooleanTest *
1203 {
1205 
1207  READ_ENUM_FIELD(booltesttype, BoolTestType);
1208  READ_LOCATION_FIELD(location);
1209 
1210  READ_DONE();
1211 }
1212 
1213 /*
1214  * _readCoerceToDomain
1215  */
1216 static CoerceToDomain *
1218 {
1220 
1222  READ_OID_FIELD(resulttype);
1223  READ_INT_FIELD(resulttypmod);
1224  READ_OID_FIELD(resultcollid);
1225  READ_ENUM_FIELD(coercionformat, CoercionForm);
1226  READ_LOCATION_FIELD(location);
1227 
1228  READ_DONE();
1229 }
1230 
1231 /*
1232  * _readCoerceToDomainValue
1233  */
1234 static CoerceToDomainValue *
1236 {
1238 
1239  READ_OID_FIELD(typeId);
1240  READ_INT_FIELD(typeMod);
1241  READ_OID_FIELD(collation);
1242  READ_LOCATION_FIELD(location);
1243 
1244  READ_DONE();
1245 }
1246 
1247 /*
1248  * _readSetToDefault
1249  */
1250 static SetToDefault *
1252 {
1254 
1255  READ_OID_FIELD(typeId);
1256  READ_INT_FIELD(typeMod);
1257  READ_OID_FIELD(collation);
1258  READ_LOCATION_FIELD(location);
1259 
1260  READ_DONE();
1261 }
1262 
1263 /*
1264  * _readCurrentOfExpr
1265  */
1266 static CurrentOfExpr *
1268 {
1270 
1271  READ_UINT_FIELD(cvarno);
1272  READ_STRING_FIELD(cursor_name);
1273  READ_INT_FIELD(cursor_param);
1274 
1275  READ_DONE();
1276 }
1277 
1278 /*
1279  * _readNextValueExpr
1280  */
1281 static NextValueExpr *
1283 {
1285 
1286  READ_OID_FIELD(seqid);
1287  READ_OID_FIELD(typeId);
1288 
1289  READ_DONE();
1290 }
1291 
1292 /*
1293  * _readInferenceElem
1294  */
1295 static InferenceElem *
1297 {
1299 
1300  READ_NODE_FIELD(expr);
1301  READ_OID_FIELD(infercollid);
1302  READ_OID_FIELD(inferopclass);
1303 
1304  READ_DONE();
1305 }
1306 
1307 /*
1308  * _readTargetEntry
1309  */
1310 static TargetEntry *
1312 {
1314 
1315  READ_NODE_FIELD(expr);
1316  READ_INT_FIELD(resno);
1317  READ_STRING_FIELD(resname);
1318  READ_UINT_FIELD(ressortgroupref);
1319  READ_OID_FIELD(resorigtbl);
1320  READ_INT_FIELD(resorigcol);
1321  READ_BOOL_FIELD(resjunk);
1322 
1323  READ_DONE();
1324 }
1325 
1326 /*
1327  * _readRangeTblRef
1328  */
1329 static RangeTblRef *
1331 {
1333 
1334  READ_INT_FIELD(rtindex);
1335 
1336  READ_DONE();
1337 }
1338 
1339 /*
1340  * _readJoinExpr
1341  */
1342 static JoinExpr *
1344 {
1346 
1347  READ_ENUM_FIELD(jointype, JoinType);
1348  READ_BOOL_FIELD(isNatural);
1349  READ_NODE_FIELD(larg);
1350  READ_NODE_FIELD(rarg);
1351  READ_NODE_FIELD(usingClause);
1352  READ_NODE_FIELD(join_using_alias);
1353  READ_NODE_FIELD(quals);
1354  READ_NODE_FIELD(alias);
1355  READ_INT_FIELD(rtindex);
1356 
1357  READ_DONE();
1358 }
1359 
1360 /*
1361  * _readFromExpr
1362  */
1363 static FromExpr *
1365 {
1367 
1368  READ_NODE_FIELD(fromlist);
1369  READ_NODE_FIELD(quals);
1370 
1371  READ_DONE();
1372 }
1373 
1374 /*
1375  * _readOnConflictExpr
1376  */
1377 static OnConflictExpr *
1379 {
1381 
1383  READ_NODE_FIELD(arbiterElems);
1384  READ_NODE_FIELD(arbiterWhere);
1385  READ_OID_FIELD(constraint);
1386  READ_NODE_FIELD(onConflictSet);
1387  READ_NODE_FIELD(onConflictWhere);
1388  READ_INT_FIELD(exclRelIndex);
1389  READ_NODE_FIELD(exclRelTlist);
1390 
1391  READ_DONE();
1392 }
1393 
1394 /*
1395  * Stuff from pathnodes.h.
1396  *
1397  * Mostly we don't need to read planner nodes back in again, but some
1398  * of these also end up in plan trees.
1399  */
1400 
1401 /*
1402  * _readAppendRelInfo
1403  */
1404 static AppendRelInfo *
1406 {
1408 
1409  READ_UINT_FIELD(parent_relid);
1410  READ_UINT_FIELD(child_relid);
1411  READ_OID_FIELD(parent_reltype);
1412  READ_OID_FIELD(child_reltype);
1413  READ_NODE_FIELD(translated_vars);
1414  READ_INT_FIELD(num_child_cols);
1415  READ_ATTRNUMBER_ARRAY(parent_colnos, local_node->num_child_cols);
1416  READ_OID_FIELD(parent_reloid);
1417 
1418  READ_DONE();
1419 }
1420 
1421 /*
1422  * Stuff from parsenodes.h.
1423  */
1424 
1425 /*
1426  * _readRangeTblEntry
1427  */
1428 static RangeTblEntry *
1430 {
1432 
1433  /* put alias + eref first to make dump more legible */
1434  READ_NODE_FIELD(alias);
1435  READ_NODE_FIELD(eref);
1436  READ_ENUM_FIELD(rtekind, RTEKind);
1437 
1438  switch (local_node->rtekind)
1439  {
1440  case RTE_RELATION:
1441  READ_OID_FIELD(relid);
1442  READ_CHAR_FIELD(relkind);
1443  READ_INT_FIELD(rellockmode);
1444  READ_NODE_FIELD(tablesample);
1445  break;
1446  case RTE_SUBQUERY:
1447  READ_NODE_FIELD(subquery);
1448  READ_BOOL_FIELD(security_barrier);
1449  break;
1450  case RTE_JOIN:
1451  READ_ENUM_FIELD(jointype, JoinType);
1452  READ_INT_FIELD(joinmergedcols);
1453  READ_NODE_FIELD(joinaliasvars);
1454  READ_NODE_FIELD(joinleftcols);
1455  READ_NODE_FIELD(joinrightcols);
1456  READ_NODE_FIELD(join_using_alias);
1457  break;
1458  case RTE_FUNCTION:
1460  READ_BOOL_FIELD(funcordinality);
1461  break;
1462  case RTE_TABLEFUNC:
1463  READ_NODE_FIELD(tablefunc);
1464  /* The RTE must have a copy of the column type info, if any */
1465  if (local_node->tablefunc)
1466  {
1467  TableFunc *tf = local_node->tablefunc;
1468 
1469  local_node->coltypes = tf->coltypes;
1470  local_node->coltypmods = tf->coltypmods;
1471  local_node->colcollations = tf->colcollations;
1472  }
1473  break;
1474  case RTE_VALUES:
1475  READ_NODE_FIELD(values_lists);
1476  READ_NODE_FIELD(coltypes);
1477  READ_NODE_FIELD(coltypmods);
1478  READ_NODE_FIELD(colcollations);
1479  break;
1480  case RTE_CTE:
1481  READ_STRING_FIELD(ctename);
1482  READ_UINT_FIELD(ctelevelsup);
1483  READ_BOOL_FIELD(self_reference);
1484  READ_NODE_FIELD(coltypes);
1485  READ_NODE_FIELD(coltypmods);
1486  READ_NODE_FIELD(colcollations);
1487  break;
1488  case RTE_NAMEDTUPLESTORE:
1489  READ_STRING_FIELD(enrname);
1490  READ_FLOAT_FIELD(enrtuples);
1491  READ_OID_FIELD(relid);
1492  READ_NODE_FIELD(coltypes);
1493  READ_NODE_FIELD(coltypmods);
1494  READ_NODE_FIELD(colcollations);
1495  break;
1496  case RTE_RESULT:
1497  /* no extra fields */
1498  break;
1499  default:
1500  elog(ERROR, "unrecognized RTE kind: %d",
1501  (int) local_node->rtekind);
1502  break;
1503  }
1504 
1505  READ_BOOL_FIELD(lateral);
1506  READ_BOOL_FIELD(inh);
1507  READ_BOOL_FIELD(inFromCl);
1508  READ_UINT_FIELD(requiredPerms);
1509  READ_OID_FIELD(checkAsUser);
1510  READ_BITMAPSET_FIELD(selectedCols);
1511  READ_BITMAPSET_FIELD(insertedCols);
1512  READ_BITMAPSET_FIELD(updatedCols);
1513  READ_BITMAPSET_FIELD(extraUpdatedCols);
1514  READ_NODE_FIELD(securityQuals);
1515 
1516  READ_DONE();
1517 }
1518 
1519 /*
1520  * _readRangeTblFunction
1521  */
1522 static RangeTblFunction *
1524 {
1526 
1527  READ_NODE_FIELD(funcexpr);
1528  READ_INT_FIELD(funccolcount);
1529  READ_NODE_FIELD(funccolnames);
1530  READ_NODE_FIELD(funccoltypes);
1531  READ_NODE_FIELD(funccoltypmods);
1532  READ_NODE_FIELD(funccolcollations);
1533  READ_BITMAPSET_FIELD(funcparams);
1534 
1535  READ_DONE();
1536 }
1537 
1538 /*
1539  * _readTableSampleClause
1540  */
1541 static TableSampleClause *
1543 {
1545 
1546  READ_OID_FIELD(tsmhandler);
1548  READ_NODE_FIELD(repeatable);
1549 
1550  READ_DONE();
1551 }
1552 
1553 /*
1554  * _readDefElem
1555  */
1556 static DefElem *
1558 {
1560 
1561  READ_STRING_FIELD(defnamespace);
1562  READ_STRING_FIELD(defname);
1564  READ_ENUM_FIELD(defaction, DefElemAction);
1565  READ_LOCATION_FIELD(location);
1566 
1567  READ_DONE();
1568 }
1569 
1570 /*
1571  * Stuff from plannodes.h.
1572  */
1573 
1574 /*
1575  * _readPlannedStmt
1576  */
1577 static PlannedStmt *
1579 {
1581 
1582  READ_ENUM_FIELD(commandType, CmdType);
1583  READ_UINT64_FIELD(queryId);
1584  READ_BOOL_FIELD(hasReturning);
1585  READ_BOOL_FIELD(hasModifyingCTE);
1586  READ_BOOL_FIELD(canSetTag);
1587  READ_BOOL_FIELD(transientPlan);
1588  READ_BOOL_FIELD(dependsOnRole);
1589  READ_BOOL_FIELD(parallelModeNeeded);
1590  READ_INT_FIELD(jitFlags);
1591  READ_NODE_FIELD(planTree);
1592  READ_NODE_FIELD(rtable);
1593  READ_NODE_FIELD(resultRelations);
1594  READ_NODE_FIELD(appendRelations);
1595  READ_NODE_FIELD(subplans);
1596  READ_BITMAPSET_FIELD(rewindPlanIDs);
1597  READ_NODE_FIELD(rowMarks);
1598  READ_NODE_FIELD(relationOids);
1599  READ_NODE_FIELD(invalItems);
1600  READ_NODE_FIELD(paramExecTypes);
1601  READ_NODE_FIELD(utilityStmt);
1602  READ_LOCATION_FIELD(stmt_location);
1603  READ_INT_FIELD(stmt_len);
1604 
1605  READ_DONE();
1606 }
1607 
1608 /*
1609  * ReadCommonPlan
1610  * Assign the basic stuff of all nodes that inherit from Plan
1611  */
1612 static void
1613 ReadCommonPlan(Plan *local_node)
1614 {
1615  READ_TEMP_LOCALS();
1616 
1617  READ_FLOAT_FIELD(startup_cost);
1618  READ_FLOAT_FIELD(total_cost);
1619  READ_FLOAT_FIELD(plan_rows);
1620  READ_INT_FIELD(plan_width);
1621  READ_BOOL_FIELD(parallel_aware);
1622  READ_BOOL_FIELD(parallel_safe);
1623  READ_BOOL_FIELD(async_capable);
1624  READ_INT_FIELD(plan_node_id);
1625  READ_NODE_FIELD(targetlist);
1626  READ_NODE_FIELD(qual);
1627  READ_NODE_FIELD(lefttree);
1628  READ_NODE_FIELD(righttree);
1629  READ_NODE_FIELD(initPlan);
1630  READ_BITMAPSET_FIELD(extParam);
1631  READ_BITMAPSET_FIELD(allParam);
1632 }
1633 
1634 /*
1635  * _readPlan
1636  */
1637 static Plan *
1639 {
1641 
1642  ReadCommonPlan(local_node);
1643 
1644  READ_DONE();
1645 }
1646 
1647 /*
1648  * _readResult
1649  */
1650 static Result *
1652 {
1654 
1655  ReadCommonPlan(&local_node->plan);
1656 
1657  READ_NODE_FIELD(resconstantqual);
1658 
1659  READ_DONE();
1660 }
1661 
1662 /*
1663  * _readProjectSet
1664  */
1665 static ProjectSet *
1667 {
1669 
1670  ReadCommonPlan(&local_node->plan);
1671 
1672  READ_DONE();
1673 }
1674 
1675 /*
1676  * _readModifyTable
1677  */
1678 static ModifyTable *
1680 {
1682 
1683  ReadCommonPlan(&local_node->plan);
1684 
1685  READ_ENUM_FIELD(operation, CmdType);
1686  READ_BOOL_FIELD(canSetTag);
1687  READ_UINT_FIELD(nominalRelation);
1688  READ_UINT_FIELD(rootRelation);
1689  READ_BOOL_FIELD(partColsUpdated);
1690  READ_NODE_FIELD(resultRelations);
1691  READ_NODE_FIELD(updateColnosLists);
1692  READ_NODE_FIELD(withCheckOptionLists);
1693  READ_NODE_FIELD(returningLists);
1694  READ_NODE_FIELD(fdwPrivLists);
1695  READ_BITMAPSET_FIELD(fdwDirectModifyPlans);
1696  READ_NODE_FIELD(rowMarks);
1697  READ_INT_FIELD(epqParam);
1698  READ_ENUM_FIELD(onConflictAction, OnConflictAction);
1699  READ_NODE_FIELD(arbiterIndexes);
1700  READ_NODE_FIELD(onConflictSet);
1701  READ_NODE_FIELD(onConflictCols);
1702  READ_NODE_FIELD(onConflictWhere);
1703  READ_UINT_FIELD(exclRelRTI);
1704  READ_NODE_FIELD(exclRelTlist);
1705 
1706  READ_DONE();
1707 }
1708 
1709 /*
1710  * _readAppend
1711  */
1712 static Append *
1714 {
1716 
1717  ReadCommonPlan(&local_node->plan);
1718 
1719  READ_BITMAPSET_FIELD(apprelids);
1720  READ_NODE_FIELD(appendplans);
1721  READ_INT_FIELD(nasyncplans);
1722  READ_INT_FIELD(first_partial_plan);
1723  READ_NODE_FIELD(part_prune_info);
1724 
1725  READ_DONE();
1726 }
1727 
1728 /*
1729  * _readMergeAppend
1730  */
1731 static MergeAppend *
1733 {
1735 
1736  ReadCommonPlan(&local_node->plan);
1737 
1738  READ_BITMAPSET_FIELD(apprelids);
1739  READ_NODE_FIELD(mergeplans);
1740  READ_INT_FIELD(numCols);
1741  READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
1742  READ_OID_ARRAY(sortOperators, local_node->numCols);
1743  READ_OID_ARRAY(collations, local_node->numCols);
1744  READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
1745  READ_NODE_FIELD(part_prune_info);
1746 
1747  READ_DONE();
1748 }
1749 
1750 /*
1751  * _readRecursiveUnion
1752  */
1753 static RecursiveUnion *
1755 {
1757 
1758  ReadCommonPlan(&local_node->plan);
1759 
1760  READ_INT_FIELD(wtParam);
1761  READ_INT_FIELD(numCols);
1762  READ_ATTRNUMBER_ARRAY(dupColIdx, local_node->numCols);
1763  READ_OID_ARRAY(dupOperators, local_node->numCols);
1764  READ_OID_ARRAY(dupCollations, local_node->numCols);
1765  READ_LONG_FIELD(numGroups);
1766 
1767  READ_DONE();
1768 }
1769 
1770 /*
1771  * _readBitmapAnd
1772  */
1773 static BitmapAnd *
1775 {
1777 
1778  ReadCommonPlan(&local_node->plan);
1779 
1780  READ_NODE_FIELD(bitmapplans);
1781 
1782  READ_DONE();
1783 }
1784 
1785 /*
1786  * _readBitmapOr
1787  */
1788 static BitmapOr *
1790 {
1792 
1793  ReadCommonPlan(&local_node->plan);
1794 
1795  READ_BOOL_FIELD(isshared);
1796  READ_NODE_FIELD(bitmapplans);
1797 
1798  READ_DONE();
1799 }
1800 
1801 /*
1802  * ReadCommonScan
1803  * Assign the basic stuff of all nodes that inherit from Scan
1804  */
1805 static void
1806 ReadCommonScan(Scan *local_node)
1807 {
1808  READ_TEMP_LOCALS();
1809 
1810  ReadCommonPlan(&local_node->plan);
1811 
1812  READ_UINT_FIELD(scanrelid);
1813 }
1814 
1815 /*
1816  * _readScan
1817  */
1818 static Scan *
1820 {
1822 
1823  ReadCommonScan(local_node);
1824 
1825  READ_DONE();
1826 }
1827 
1828 /*
1829  * _readSeqScan
1830  */
1831 static SeqScan *
1833 {
1835 
1836  ReadCommonScan(local_node);
1837 
1838  READ_DONE();
1839 }
1840 
1841 /*
1842  * _readSampleScan
1843  */
1844 static SampleScan *
1846 {
1848 
1849  ReadCommonScan(&local_node->scan);
1850 
1851  READ_NODE_FIELD(tablesample);
1852 
1853  READ_DONE();
1854 }
1855 
1856 /*
1857  * _readIndexScan
1858  */
1859 static IndexScan *
1861 {
1863 
1864  ReadCommonScan(&local_node->scan);
1865 
1866  READ_OID_FIELD(indexid);
1867  READ_NODE_FIELD(indexqual);
1868  READ_NODE_FIELD(indexqualorig);
1869  READ_NODE_FIELD(indexorderby);
1870  READ_NODE_FIELD(indexorderbyorig);
1871  READ_NODE_FIELD(indexorderbyops);
1872  READ_ENUM_FIELD(indexorderdir, ScanDirection);
1873 
1874  READ_DONE();
1875 }
1876 
1877 /*
1878  * _readIndexOnlyScan
1879  */
1880 static IndexOnlyScan *
1882 {
1884 
1885  ReadCommonScan(&local_node->scan);
1886 
1887  READ_OID_FIELD(indexid);
1888  READ_NODE_FIELD(indexqual);
1889  READ_NODE_FIELD(indexorderby);
1890  READ_NODE_FIELD(indextlist);
1891  READ_ENUM_FIELD(indexorderdir, ScanDirection);
1892 
1893  READ_DONE();
1894 }
1895 
1896 /*
1897  * _readBitmapIndexScan
1898  */
1899 static BitmapIndexScan *
1901 {
1903 
1904  ReadCommonScan(&local_node->scan);
1905 
1906  READ_OID_FIELD(indexid);
1907  READ_BOOL_FIELD(isshared);
1908  READ_NODE_FIELD(indexqual);
1909  READ_NODE_FIELD(indexqualorig);
1910 
1911  READ_DONE();
1912 }
1913 
1914 /*
1915  * _readBitmapHeapScan
1916  */
1917 static BitmapHeapScan *
1919 {
1921 
1922  ReadCommonScan(&local_node->scan);
1923 
1924  READ_NODE_FIELD(bitmapqualorig);
1925 
1926  READ_DONE();
1927 }
1928 
1929 /*
1930  * _readTidScan
1931  */
1932 static TidScan *
1934 {
1936 
1937  ReadCommonScan(&local_node->scan);
1938 
1939  READ_NODE_FIELD(tidquals);
1940 
1941  READ_DONE();
1942 }
1943 
1944 /*
1945  * _readTidRangeScan
1946  */
1947 static TidRangeScan *
1949 {
1951 
1952  ReadCommonScan(&local_node->scan);
1953 
1954  READ_NODE_FIELD(tidrangequals);
1955 
1956  READ_DONE();
1957 }
1958 
1959 /*
1960  * _readSubqueryScan
1961  */
1962 static SubqueryScan *
1964 {
1966 
1967  ReadCommonScan(&local_node->scan);
1968 
1969  READ_NODE_FIELD(subplan);
1970 
1971  READ_DONE();
1972 }
1973 
1974 /*
1975  * _readFunctionScan
1976  */
1977 static FunctionScan *
1979 {
1981 
1982  ReadCommonScan(&local_node->scan);
1983 
1985  READ_BOOL_FIELD(funcordinality);
1986 
1987  READ_DONE();
1988 }
1989 
1990 /*
1991  * _readValuesScan
1992  */
1993 static ValuesScan *
1995 {
1997 
1998  ReadCommonScan(&local_node->scan);
1999 
2000  READ_NODE_FIELD(values_lists);
2001 
2002  READ_DONE();
2003 }
2004 
2005 /*
2006  * _readTableFuncScan
2007  */
2008 static TableFuncScan *
2010 {
2012 
2013  ReadCommonScan(&local_node->scan);
2014 
2015  READ_NODE_FIELD(tablefunc);
2016 
2017  READ_DONE();
2018 }
2019 
2020 /*
2021  * _readCteScan
2022  */
2023 static CteScan *
2025 {
2027 
2028  ReadCommonScan(&local_node->scan);
2029 
2030  READ_INT_FIELD(ctePlanId);
2031  READ_INT_FIELD(cteParam);
2032 
2033  READ_DONE();
2034 }
2035 
2036 /*
2037  * _readNamedTuplestoreScan
2038  */
2039 static NamedTuplestoreScan *
2041 {
2043 
2044  ReadCommonScan(&local_node->scan);
2045 
2046  READ_STRING_FIELD(enrname);
2047 
2048  READ_DONE();
2049 }
2050 
2051 /*
2052  * _readWorkTableScan
2053  */
2054 static WorkTableScan *
2056 {
2058 
2059  ReadCommonScan(&local_node->scan);
2060 
2061  READ_INT_FIELD(wtParam);
2062 
2063  READ_DONE();
2064 }
2065 
2066 /*
2067  * _readForeignScan
2068  */
2069 static ForeignScan *
2071 {
2073 
2074  ReadCommonScan(&local_node->scan);
2075 
2076  READ_ENUM_FIELD(operation, CmdType);
2077  READ_UINT_FIELD(resultRelation);
2078  READ_OID_FIELD(fs_server);
2079  READ_NODE_FIELD(fdw_exprs);
2080  READ_NODE_FIELD(fdw_private);
2081  READ_NODE_FIELD(fdw_scan_tlist);
2082  READ_NODE_FIELD(fdw_recheck_quals);
2083  READ_BITMAPSET_FIELD(fs_relids);
2084  READ_BOOL_FIELD(fsSystemCol);
2085 
2086  READ_DONE();
2087 }
2088 
2089 /*
2090  * _readCustomScan
2091  */
2092 static CustomScan *
2094 {
2096  char *custom_name;
2097  const CustomScanMethods *methods;
2098 
2099  ReadCommonScan(&local_node->scan);
2100 
2101  READ_UINT_FIELD(flags);
2102  READ_NODE_FIELD(custom_plans);
2103  READ_NODE_FIELD(custom_exprs);
2104  READ_NODE_FIELD(custom_private);
2105  READ_NODE_FIELD(custom_scan_tlist);
2106  READ_BITMAPSET_FIELD(custom_relids);
2107 
2108  /* Lookup CustomScanMethods by CustomName */
2109  token = pg_strtok(&length); /* skip methods: */
2110  token = pg_strtok(&length); /* CustomName */
2111  custom_name = nullable_string(token, length);
2112  methods = GetCustomScanMethods(custom_name, false);
2113  local_node->methods = methods;
2114 
2115  READ_DONE();
2116 }
2117 
2118 /*
2119  * ReadCommonJoin
2120  * Assign the basic stuff of all nodes that inherit from Join
2121  */
2122 static void
2123 ReadCommonJoin(Join *local_node)
2124 {
2125  READ_TEMP_LOCALS();
2126 
2127  ReadCommonPlan(&local_node->plan);
2128 
2129  READ_ENUM_FIELD(jointype, JoinType);
2130  READ_BOOL_FIELD(inner_unique);
2131  READ_NODE_FIELD(joinqual);
2132 }
2133 
2134 /*
2135  * _readJoin
2136  */
2137 static Join *
2139 {
2141 
2142  ReadCommonJoin(local_node);
2143 
2144  READ_DONE();
2145 }
2146 
2147 /*
2148  * _readNestLoop
2149  */
2150 static NestLoop *
2152 {
2154 
2155  ReadCommonJoin(&local_node->join);
2156 
2157  READ_NODE_FIELD(nestParams);
2158 
2159  READ_DONE();
2160 }
2161 
2162 /*
2163  * _readMergeJoin
2164  */
2165 static MergeJoin *
2167 {
2168  int numCols;
2169 
2171 
2172  ReadCommonJoin(&local_node->join);
2173 
2174  READ_BOOL_FIELD(skip_mark_restore);
2175  READ_NODE_FIELD(mergeclauses);
2176 
2177  numCols = list_length(local_node->mergeclauses);
2178 
2179  READ_OID_ARRAY(mergeFamilies, numCols);
2180  READ_OID_ARRAY(mergeCollations, numCols);
2181  READ_INT_ARRAY(mergeStrategies, numCols);
2182  READ_BOOL_ARRAY(mergeNullsFirst, numCols);
2183 
2184  READ_DONE();
2185 }
2186 
2187 /*
2188  * _readHashJoin
2189  */
2190 static HashJoin *
2192 {
2194 
2195  ReadCommonJoin(&local_node->join);
2196 
2197  READ_NODE_FIELD(hashclauses);
2198  READ_NODE_FIELD(hashoperators);
2199  READ_NODE_FIELD(hashcollations);
2200  READ_NODE_FIELD(hashkeys);
2201 
2202  READ_DONE();
2203 }
2204 
2205 /*
2206  * _readMaterial
2207  */
2208 static Material *
2210 {
2212 
2213  ReadCommonPlan(&local_node->plan);
2214 
2215  READ_DONE();
2216 }
2217 
2218 /*
2219  * _readMemoize
2220  */
2221 static Memoize *
2223 {
2225 
2226  ReadCommonPlan(&local_node->plan);
2227 
2228  READ_INT_FIELD(numKeys);
2229  READ_OID_ARRAY(hashOperators, local_node->numKeys);
2230  READ_OID_ARRAY(collations, local_node->numKeys);
2231  READ_NODE_FIELD(param_exprs);
2232  READ_BOOL_FIELD(singlerow);
2233  READ_UINT_FIELD(est_entries);
2234 
2235  READ_DONE();
2236 }
2237 
2238 /*
2239  * ReadCommonSort
2240  * Assign the basic stuff of all nodes that inherit from Sort
2241  */
2242 static void
2243 ReadCommonSort(Sort *local_node)
2244 {
2245  READ_TEMP_LOCALS();
2246 
2247  ReadCommonPlan(&local_node->plan);
2248 
2249  READ_INT_FIELD(numCols);
2250  READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
2251  READ_OID_ARRAY(sortOperators, local_node->numCols);
2252  READ_OID_ARRAY(collations, local_node->numCols);
2253  READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
2254 }
2255 
2256 /*
2257  * _readSort
2258  */
2259 static Sort *
2261 {
2263 
2264  ReadCommonSort(local_node);
2265 
2266  READ_DONE();
2267 }
2268 
2269 /*
2270  * _readIncrementalSort
2271  */
2272 static IncrementalSort *
2274 {
2276 
2277  ReadCommonSort(&local_node->sort);
2278 
2279  READ_INT_FIELD(nPresortedCols);
2280 
2281  READ_DONE();
2282 }
2283 
2284 /*
2285  * _readGroup
2286  */
2287 static Group *
2289 {
2290  READ_LOCALS(Group);
2291 
2292  ReadCommonPlan(&local_node->plan);
2293 
2294  READ_INT_FIELD(numCols);
2295  READ_ATTRNUMBER_ARRAY(grpColIdx, local_node->numCols);
2296  READ_OID_ARRAY(grpOperators, local_node->numCols);
2297  READ_OID_ARRAY(grpCollations, local_node->numCols);
2298 
2299  READ_DONE();
2300 }
2301 
2302 /*
2303  * _readAgg
2304  */
2305 static Agg *
2307 {
2308  READ_LOCALS(Agg);
2309 
2310  ReadCommonPlan(&local_node->plan);
2311 
2312  READ_ENUM_FIELD(aggstrategy, AggStrategy);
2313  READ_ENUM_FIELD(aggsplit, AggSplit);
2314  READ_INT_FIELD(numCols);
2315  READ_ATTRNUMBER_ARRAY(grpColIdx, local_node->numCols);
2316  READ_OID_ARRAY(grpOperators, local_node->numCols);
2317  READ_OID_ARRAY(grpCollations, local_node->numCols);
2318  READ_LONG_FIELD(numGroups);
2319  READ_UINT64_FIELD(transitionSpace);
2320  READ_BITMAPSET_FIELD(aggParams);
2321  READ_NODE_FIELD(groupingSets);
2322  READ_NODE_FIELD(chain);
2323 
2324  READ_DONE();
2325 }
2326 
2327 /*
2328  * _readWindowAgg
2329  */
2330 static WindowAgg *
2332 {
2334 
2335  ReadCommonPlan(&local_node->plan);
2336 
2337  READ_UINT_FIELD(winref);
2338  READ_INT_FIELD(partNumCols);
2339  READ_ATTRNUMBER_ARRAY(partColIdx, local_node->partNumCols);
2340  READ_OID_ARRAY(partOperators, local_node->partNumCols);
2341  READ_OID_ARRAY(partCollations, local_node->partNumCols);
2342  READ_INT_FIELD(ordNumCols);
2343  READ_ATTRNUMBER_ARRAY(ordColIdx, local_node->ordNumCols);
2344  READ_OID_ARRAY(ordOperators, local_node->ordNumCols);
2345  READ_OID_ARRAY(ordCollations, local_node->ordNumCols);
2346  READ_INT_FIELD(frameOptions);
2347  READ_NODE_FIELD(startOffset);
2348  READ_NODE_FIELD(endOffset);
2349  READ_OID_FIELD(startInRangeFunc);
2350  READ_OID_FIELD(endInRangeFunc);
2351  READ_OID_FIELD(inRangeColl);
2352  READ_BOOL_FIELD(inRangeAsc);
2353  READ_BOOL_FIELD(inRangeNullsFirst);
2354 
2355  READ_DONE();
2356 }
2357 
2358 /*
2359  * _readUnique
2360  */
2361 static Unique *
2363 {
2365 
2366  ReadCommonPlan(&local_node->plan);
2367 
2368  READ_INT_FIELD(numCols);
2369  READ_ATTRNUMBER_ARRAY(uniqColIdx, local_node->numCols);
2370  READ_OID_ARRAY(uniqOperators, local_node->numCols);
2371  READ_OID_ARRAY(uniqCollations, local_node->numCols);
2372 
2373  READ_DONE();
2374 }
2375 
2376 /*
2377  * _readGather
2378  */
2379 static Gather *
2381 {
2383 
2384  ReadCommonPlan(&local_node->plan);
2385 
2386  READ_INT_FIELD(num_workers);
2387  READ_INT_FIELD(rescan_param);
2388  READ_BOOL_FIELD(single_copy);
2389  READ_BOOL_FIELD(invisible);
2390  READ_BITMAPSET_FIELD(initParam);
2391 
2392  READ_DONE();
2393 }
2394 
2395 /*
2396  * _readGatherMerge
2397  */
2398 static GatherMerge *
2400 {
2402 
2403  ReadCommonPlan(&local_node->plan);
2404 
2405  READ_INT_FIELD(num_workers);
2406  READ_INT_FIELD(rescan_param);
2407  READ_INT_FIELD(numCols);
2408  READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
2409  READ_OID_ARRAY(sortOperators, local_node->numCols);
2410  READ_OID_ARRAY(collations, local_node->numCols);
2411  READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
2412  READ_BITMAPSET_FIELD(initParam);
2413 
2414  READ_DONE();
2415 }
2416 
2417 /*
2418  * _readHash
2419  */
2420 static Hash *
2422 {
2423  READ_LOCALS(Hash);
2424 
2425  ReadCommonPlan(&local_node->plan);
2426 
2427  READ_NODE_FIELD(hashkeys);
2428  READ_OID_FIELD(skewTable);
2429  READ_INT_FIELD(skewColumn);
2430  READ_BOOL_FIELD(skewInherit);
2431  READ_FLOAT_FIELD(rows_total);
2432 
2433  READ_DONE();
2434 }
2435 
2436 /*
2437  * _readSetOp
2438  */
2439 static SetOp *
2441 {
2442  READ_LOCALS(SetOp);
2443 
2444  ReadCommonPlan(&local_node->plan);
2445 
2446  READ_ENUM_FIELD(cmd, SetOpCmd);
2447  READ_ENUM_FIELD(strategy, SetOpStrategy);
2448  READ_INT_FIELD(numCols);
2449  READ_ATTRNUMBER_ARRAY(dupColIdx, local_node->numCols);
2450  READ_OID_ARRAY(dupOperators, local_node->numCols);
2451  READ_OID_ARRAY(dupCollations, local_node->numCols);
2452  READ_INT_FIELD(flagColIdx);
2453  READ_INT_FIELD(firstFlag);
2454  READ_LONG_FIELD(numGroups);
2455 
2456  READ_DONE();
2457 }
2458 
2459 /*
2460  * _readLockRows
2461  */
2462 static LockRows *
2464 {
2466 
2467  ReadCommonPlan(&local_node->plan);
2468 
2469  READ_NODE_FIELD(rowMarks);
2470  READ_INT_FIELD(epqParam);
2471 
2472  READ_DONE();
2473 }
2474 
2475 /*
2476  * _readLimit
2477  */
2478 static Limit *
2480 {
2481  READ_LOCALS(Limit);
2482 
2483  ReadCommonPlan(&local_node->plan);
2484 
2485  READ_NODE_FIELD(limitOffset);
2486  READ_NODE_FIELD(limitCount);
2487  READ_ENUM_FIELD(limitOption, LimitOption);
2488  READ_INT_FIELD(uniqNumCols);
2489  READ_ATTRNUMBER_ARRAY(uniqColIdx, local_node->uniqNumCols);
2490  READ_OID_ARRAY(uniqOperators, local_node->uniqNumCols);
2491  READ_OID_ARRAY(uniqCollations, local_node->uniqNumCols);
2492 
2493  READ_DONE();
2494 }
2495 
2496 /*
2497  * _readNestLoopParam
2498  */
2499 static NestLoopParam *
2501 {
2503 
2504  READ_INT_FIELD(paramno);
2505  READ_NODE_FIELD(paramval);
2506 
2507  READ_DONE();
2508 }
2509 
2510 /*
2511  * _readPlanRowMark
2512  */
2513 static PlanRowMark *
2515 {
2517 
2518  READ_UINT_FIELD(rti);
2519  READ_UINT_FIELD(prti);
2520  READ_UINT_FIELD(rowmarkId);
2521  READ_ENUM_FIELD(markType, RowMarkType);
2522  READ_INT_FIELD(allMarkTypes);
2524  READ_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2525  READ_BOOL_FIELD(isParent);
2526 
2527  READ_DONE();
2528 }
2529 
2530 static PartitionPruneInfo *
2532 {
2534 
2535  READ_NODE_FIELD(prune_infos);
2536  READ_BITMAPSET_FIELD(other_subplans);
2537 
2538  READ_DONE();
2539 }
2540 
2541 static PartitionedRelPruneInfo *
2543 {
2545 
2546  READ_UINT_FIELD(rtindex);
2547  READ_BITMAPSET_FIELD(present_parts);
2548  READ_INT_FIELD(nparts);
2549  READ_INT_ARRAY(subplan_map, local_node->nparts);
2550  READ_INT_ARRAY(subpart_map, local_node->nparts);
2551  READ_OID_ARRAY(relid_map, local_node->nparts);
2552  READ_NODE_FIELD(initial_pruning_steps);
2553  READ_NODE_FIELD(exec_pruning_steps);
2554  READ_BITMAPSET_FIELD(execparamids);
2555 
2556  READ_DONE();
2557 }
2558 
2559 static PartitionPruneStepOp *
2561 {
2563 
2564  READ_INT_FIELD(step.step_id);
2565  READ_INT_FIELD(opstrategy);
2566  READ_NODE_FIELD(exprs);
2567  READ_NODE_FIELD(cmpfns);
2568  READ_BITMAPSET_FIELD(nullkeys);
2569 
2570  READ_DONE();
2571 }
2572 
2575 {
2577 
2578  READ_INT_FIELD(step.step_id);
2580  READ_NODE_FIELD(source_stepids);
2581 
2582  READ_DONE();
2583 }
2584 
2585 /*
2586  * _readPlanInvalItem
2587  */
2588 static PlanInvalItem *
2590 {
2592 
2593  READ_INT_FIELD(cacheId);
2594  READ_UINT_FIELD(hashValue);
2595 
2596  READ_DONE();
2597 }
2598 
2599 /*
2600  * _readSubPlan
2601  */
2602 static SubPlan *
2604 {
2606 
2607  READ_ENUM_FIELD(subLinkType, SubLinkType);
2608  READ_NODE_FIELD(testexpr);
2609  READ_NODE_FIELD(paramIds);
2610  READ_INT_FIELD(plan_id);
2611  READ_STRING_FIELD(plan_name);
2612  READ_OID_FIELD(firstColType);
2613  READ_INT_FIELD(firstColTypmod);
2614  READ_OID_FIELD(firstColCollation);
2615  READ_BOOL_FIELD(useHashTable);
2616  READ_BOOL_FIELD(unknownEqFalse);
2617  READ_BOOL_FIELD(parallel_safe);
2618  READ_NODE_FIELD(setParam);
2619  READ_NODE_FIELD(parParam);
2621  READ_FLOAT_FIELD(startup_cost);
2622  READ_FLOAT_FIELD(per_call_cost);
2623 
2624  READ_DONE();
2625 }
2626 
2627 /*
2628  * _readAlternativeSubPlan
2629  */
2630 static AlternativeSubPlan *
2632 {
2634 
2635  READ_NODE_FIELD(subplans);
2636 
2637  READ_DONE();
2638 }
2639 
2640 /*
2641  * _readExtensibleNode
2642  */
2643 static ExtensibleNode *
2645 {
2646  const ExtensibleNodeMethods *methods;
2647  ExtensibleNode *local_node;
2648  const char *extnodename;
2649 
2650  READ_TEMP_LOCALS();
2651 
2652  token = pg_strtok(&length); /* skip :extnodename */
2653  token = pg_strtok(&length); /* get extnodename */
2654 
2655  extnodename = nullable_string(token, length);
2656  if (!extnodename)
2657  elog(ERROR, "extnodename has to be supplied");
2658  methods = GetExtensibleNodeMethods(extnodename, false);
2659 
2660  local_node = (ExtensibleNode *) newNode(methods->node_size,
2662  local_node->extnodename = extnodename;
2663 
2664  /* deserialize the private fields */
2665  methods->nodeRead(local_node);
2666 
2667  READ_DONE();
2668 }
2669 
2670 /*
2671  * _readPartitionBoundSpec
2672  */
2673 static PartitionBoundSpec *
2675 {
2677 
2678  READ_CHAR_FIELD(strategy);
2679  READ_BOOL_FIELD(is_default);
2680  READ_INT_FIELD(modulus);
2681  READ_INT_FIELD(remainder);
2682  READ_NODE_FIELD(listdatums);
2683  READ_NODE_FIELD(lowerdatums);
2684  READ_NODE_FIELD(upperdatums);
2685  READ_LOCATION_FIELD(location);
2686 
2687  READ_DONE();
2688 }
2689 
2690 /*
2691  * _readPartitionRangeDatum
2692  */
2693 static PartitionRangeDatum *
2695 {
2697 
2700  READ_LOCATION_FIELD(location);
2701 
2702  READ_DONE();
2703 }
2704 
2705 /*
2706  * parseNodeString
2707  *
2708  * Given a character string representing a node tree, parseNodeString creates
2709  * the internal node structure.
2710  *
2711  * The string to be read must already have been loaded into pg_strtok().
2712  */
2713 Node *
2715 {
2716  void *return_value;
2717 
2718  READ_TEMP_LOCALS();
2719 
2720  /* Guard against stack overflow due to overly complex expressions */
2722 
2723  token = pg_strtok(&length);
2724 
2725 #define MATCH(tokname, namelen) \
2726  (length == namelen && memcmp(token, tokname, namelen) == 0)
2727 
2728  if (MATCH("QUERY", 5))
2729  return_value = _readQuery();
2730  else if (MATCH("WITHCHECKOPTION", 15))
2731  return_value = _readWithCheckOption();
2732  else if (MATCH("SORTGROUPCLAUSE", 15))
2733  return_value = _readSortGroupClause();
2734  else if (MATCH("GROUPINGSET", 11))
2735  return_value = _readGroupingSet();
2736  else if (MATCH("WINDOWCLAUSE", 12))
2737  return_value = _readWindowClause();
2738  else if (MATCH("ROWMARKCLAUSE", 13))
2739  return_value = _readRowMarkClause();
2740  else if (MATCH("CTESEARCHCLAUSE", 15))
2741  return_value = _readCTESearchClause();
2742  else if (MATCH("CTECYCLECLAUSE", 14))
2743  return_value = _readCTECycleClause();
2744  else if (MATCH("COMMONTABLEEXPR", 15))
2745  return_value = _readCommonTableExpr();
2746  else if (MATCH("SETOPERATIONSTMT", 16))
2747  return_value = _readSetOperationStmt();
2748  else if (MATCH("ALIAS", 5))
2749  return_value = _readAlias();
2750  else if (MATCH("RANGEVAR", 8))
2751  return_value = _readRangeVar();
2752  else if (MATCH("INTOCLAUSE", 10))
2753  return_value = _readIntoClause();
2754  else if (MATCH("TABLEFUNC", 9))
2755  return_value = _readTableFunc();
2756  else if (MATCH("VAR", 3))
2757  return_value = _readVar();
2758  else if (MATCH("CONST", 5))
2759  return_value = _readConst();
2760  else if (MATCH("PARAM", 5))
2761  return_value = _readParam();
2762  else if (MATCH("AGGREF", 6))
2763  return_value = _readAggref();
2764  else if (MATCH("GROUPINGFUNC", 12))
2765  return_value = _readGroupingFunc();
2766  else if (MATCH("WINDOWFUNC", 10))
2767  return_value = _readWindowFunc();
2768  else if (MATCH("SUBSCRIPTINGREF", 15))
2769  return_value = _readSubscriptingRef();
2770  else if (MATCH("FUNCEXPR", 8))
2771  return_value = _readFuncExpr();
2772  else if (MATCH("NAMEDARGEXPR", 12))
2773  return_value = _readNamedArgExpr();
2774  else if (MATCH("OPEXPR", 6))
2775  return_value = _readOpExpr();
2776  else if (MATCH("DISTINCTEXPR", 12))
2777  return_value = _readDistinctExpr();
2778  else if (MATCH("NULLIFEXPR", 10))
2779  return_value = _readNullIfExpr();
2780  else if (MATCH("SCALARARRAYOPEXPR", 17))
2781  return_value = _readScalarArrayOpExpr();
2782  else if (MATCH("BOOLEXPR", 8))
2783  return_value = _readBoolExpr();
2784  else if (MATCH("SUBLINK", 7))
2785  return_value = _readSubLink();
2786  else if (MATCH("FIELDSELECT", 11))
2787  return_value = _readFieldSelect();
2788  else if (MATCH("FIELDSTORE", 10))
2789  return_value = _readFieldStore();
2790  else if (MATCH("RELABELTYPE", 11))
2791  return_value = _readRelabelType();
2792  else if (MATCH("COERCEVIAIO", 11))
2793  return_value = _readCoerceViaIO();
2794  else if (MATCH("ARRAYCOERCEEXPR", 15))
2795  return_value = _readArrayCoerceExpr();
2796  else if (MATCH("CONVERTROWTYPEEXPR", 18))
2797  return_value = _readConvertRowtypeExpr();
2798  else if (MATCH("COLLATE", 7))
2799  return_value = _readCollateExpr();
2800  else if (MATCH("CASE", 4))
2801  return_value = _readCaseExpr();
2802  else if (MATCH("WHEN", 4))
2803  return_value = _readCaseWhen();
2804  else if (MATCH("CASETESTEXPR", 12))
2805  return_value = _readCaseTestExpr();
2806  else if (MATCH("ARRAY", 5))
2807  return_value = _readArrayExpr();
2808  else if (MATCH("ROW", 3))
2809  return_value = _readRowExpr();
2810  else if (MATCH("ROWCOMPARE", 10))
2811  return_value = _readRowCompareExpr();
2812  else if (MATCH("COALESCE", 8))
2813  return_value = _readCoalesceExpr();
2814  else if (MATCH("MINMAX", 6))
2815  return_value = _readMinMaxExpr();
2816  else if (MATCH("SQLVALUEFUNCTION", 16))
2817  return_value = _readSQLValueFunction();
2818  else if (MATCH("XMLEXPR", 7))
2819  return_value = _readXmlExpr();
2820  else if (MATCH("NULLTEST", 8))
2821  return_value = _readNullTest();
2822  else if (MATCH("BOOLEANTEST", 11))
2823  return_value = _readBooleanTest();
2824  else if (MATCH("COERCETODOMAIN", 14))
2825  return_value = _readCoerceToDomain();
2826  else if (MATCH("COERCETODOMAINVALUE", 19))
2827  return_value = _readCoerceToDomainValue();
2828  else if (MATCH("SETTODEFAULT", 12))
2829  return_value = _readSetToDefault();
2830  else if (MATCH("CURRENTOFEXPR", 13))
2831  return_value = _readCurrentOfExpr();
2832  else if (MATCH("NEXTVALUEEXPR", 13))
2833  return_value = _readNextValueExpr();
2834  else if (MATCH("INFERENCEELEM", 13))
2835  return_value = _readInferenceElem();
2836  else if (MATCH("TARGETENTRY", 11))
2837  return_value = _readTargetEntry();
2838  else if (MATCH("RANGETBLREF", 11))
2839  return_value = _readRangeTblRef();
2840  else if (MATCH("JOINEXPR", 8))
2841  return_value = _readJoinExpr();
2842  else if (MATCH("FROMEXPR", 8))
2843  return_value = _readFromExpr();
2844  else if (MATCH("ONCONFLICTEXPR", 14))
2845  return_value = _readOnConflictExpr();
2846  else if (MATCH("APPENDRELINFO", 13))
2847  return_value = _readAppendRelInfo();
2848  else if (MATCH("RTE", 3))
2849  return_value = _readRangeTblEntry();
2850  else if (MATCH("RANGETBLFUNCTION", 16))
2851  return_value = _readRangeTblFunction();
2852  else if (MATCH("TABLESAMPLECLAUSE", 17))
2853  return_value = _readTableSampleClause();
2854  else if (MATCH("NOTIFY", 6))
2855  return_value = _readNotifyStmt();
2856  else if (MATCH("DEFELEM", 7))
2857  return_value = _readDefElem();
2858  else if (MATCH("DECLARECURSOR", 13))
2859  return_value = _readDeclareCursorStmt();
2860  else if (MATCH("PLANNEDSTMT", 11))
2861  return_value = _readPlannedStmt();
2862  else if (MATCH("PLAN", 4))
2863  return_value = _readPlan();
2864  else if (MATCH("RESULT", 6))
2865  return_value = _readResult();
2866  else if (MATCH("PROJECTSET", 10))
2867  return_value = _readProjectSet();
2868  else if (MATCH("MODIFYTABLE", 11))
2869  return_value = _readModifyTable();
2870  else if (MATCH("APPEND", 6))
2871  return_value = _readAppend();
2872  else if (MATCH("MERGEAPPEND", 11))
2873  return_value = _readMergeAppend();
2874  else if (MATCH("RECURSIVEUNION", 14))
2875  return_value = _readRecursiveUnion();
2876  else if (MATCH("BITMAPAND", 9))
2877  return_value = _readBitmapAnd();
2878  else if (MATCH("BITMAPOR", 8))
2879  return_value = _readBitmapOr();
2880  else if (MATCH("SCAN", 4))
2881  return_value = _readScan();
2882  else if (MATCH("SEQSCAN", 7))
2883  return_value = _readSeqScan();
2884  else if (MATCH("SAMPLESCAN", 10))
2885  return_value = _readSampleScan();
2886  else if (MATCH("INDEXSCAN", 9))
2887  return_value = _readIndexScan();
2888  else if (MATCH("INDEXONLYSCAN", 13))
2889  return_value = _readIndexOnlyScan();
2890  else if (MATCH("BITMAPINDEXSCAN", 15))
2891  return_value = _readBitmapIndexScan();
2892  else if (MATCH("BITMAPHEAPSCAN", 14))
2893  return_value = _readBitmapHeapScan();
2894  else if (MATCH("TIDSCAN", 7))
2895  return_value = _readTidScan();
2896  else if (MATCH("TIDRANGESCAN", 12))
2897  return_value = _readTidRangeScan();
2898  else if (MATCH("SUBQUERYSCAN", 12))
2899  return_value = _readSubqueryScan();
2900  else if (MATCH("FUNCTIONSCAN", 12))
2901  return_value = _readFunctionScan();
2902  else if (MATCH("VALUESSCAN", 10))
2903  return_value = _readValuesScan();
2904  else if (MATCH("TABLEFUNCSCAN", 13))
2905  return_value = _readTableFuncScan();
2906  else if (MATCH("CTESCAN", 7))
2907  return_value = _readCteScan();
2908  else if (MATCH("NAMEDTUPLESTORESCAN", 19))
2909  return_value = _readNamedTuplestoreScan();
2910  else if (MATCH("WORKTABLESCAN", 13))
2911  return_value = _readWorkTableScan();
2912  else if (MATCH("FOREIGNSCAN", 11))
2913  return_value = _readForeignScan();
2914  else if (MATCH("CUSTOMSCAN", 10))
2915  return_value = _readCustomScan();
2916  else if (MATCH("JOIN", 4))
2917  return_value = _readJoin();
2918  else if (MATCH("NESTLOOP", 8))
2919  return_value = _readNestLoop();
2920  else if (MATCH("MERGEJOIN", 9))
2921  return_value = _readMergeJoin();
2922  else if (MATCH("HASHJOIN", 8))
2923  return_value = _readHashJoin();
2924  else if (MATCH("MATERIAL", 8))
2925  return_value = _readMaterial();
2926  else if (MATCH("MEMOIZE", 7))
2927  return_value = _readMemoize();
2928  else if (MATCH("SORT", 4))
2929  return_value = _readSort();
2930  else if (MATCH("INCREMENTALSORT", 15))
2931  return_value = _readIncrementalSort();
2932  else if (MATCH("GROUP", 5))
2933  return_value = _readGroup();
2934  else if (MATCH("AGG", 3))
2935  return_value = _readAgg();
2936  else if (MATCH("WINDOWAGG", 9))
2937  return_value = _readWindowAgg();
2938  else if (MATCH("UNIQUE", 6))
2939  return_value = _readUnique();
2940  else if (MATCH("GATHER", 6))
2941  return_value = _readGather();
2942  else if (MATCH("GATHERMERGE", 11))
2943  return_value = _readGatherMerge();
2944  else if (MATCH("HASH", 4))
2945  return_value = _readHash();
2946  else if (MATCH("SETOP", 5))
2947  return_value = _readSetOp();
2948  else if (MATCH("LOCKROWS", 8))
2949  return_value = _readLockRows();
2950  else if (MATCH("LIMIT", 5))
2951  return_value = _readLimit();
2952  else if (MATCH("NESTLOOPPARAM", 13))
2953  return_value = _readNestLoopParam();
2954  else if (MATCH("PLANROWMARK", 11))
2955  return_value = _readPlanRowMark();
2956  else if (MATCH("PARTITIONPRUNEINFO", 18))
2957  return_value = _readPartitionPruneInfo();
2958  else if (MATCH("PARTITIONEDRELPRUNEINFO", 23))
2959  return_value = _readPartitionedRelPruneInfo();
2960  else if (MATCH("PARTITIONPRUNESTEPOP", 20))
2961  return_value = _readPartitionPruneStepOp();
2962  else if (MATCH("PARTITIONPRUNESTEPCOMBINE", 25))
2963  return_value = _readPartitionPruneStepCombine();
2964  else if (MATCH("PLANINVALITEM", 13))
2965  return_value = _readPlanInvalItem();
2966  else if (MATCH("SUBPLAN", 7))
2967  return_value = _readSubPlan();
2968  else if (MATCH("ALTERNATIVESUBPLAN", 18))
2969  return_value = _readAlternativeSubPlan();
2970  else if (MATCH("EXTENSIBLENODE", 14))
2971  return_value = _readExtensibleNode();
2972  else if (MATCH("PARTITIONBOUNDSPEC", 18))
2973  return_value = _readPartitionBoundSpec();
2974  else if (MATCH("PARTITIONRANGEDATUM", 19))
2975  return_value = _readPartitionRangeDatum();
2976  else
2977  {
2978  elog(ERROR, "badly formatted node string \"%.32s\"...", token);
2979  return_value = NULL; /* keep compiler quiet */
2980  }
2981 
2982  return (Node *) return_value;
2983 }
2984 
2985 
2986 /*
2987  * readDatum
2988  *
2989  * Given a string representation of a constant, recreate the appropriate
2990  * Datum. The string representation embeds length info, but not byValue,
2991  * so we must be told that.
2992  */
2993 Datum
2994 readDatum(bool typbyval)
2995 {
2996  Size length,
2997  i;
2998  int tokenLength;
2999  const char *token;
3000  Datum res;
3001  char *s;
3002 
3003  /*
3004  * read the actual length of the value
3005  */
3006  token = pg_strtok(&tokenLength);
3007  length = atoui(token);
3008 
3009  token = pg_strtok(&tokenLength); /* read the '[' */
3010  if (token == NULL || token[0] != '[')
3011  elog(ERROR, "expected \"[\" to start datum, but got \"%s\"; length = %zu",
3012  token ? token : "[NULL]", length);
3013 
3014  if (typbyval)
3015  {
3016  if (length > (Size) sizeof(Datum))
3017  elog(ERROR, "byval datum but length = %zu", length);
3018  res = (Datum) 0;
3019  s = (char *) (&res);
3020  for (i = 0; i < (Size) sizeof(Datum); i++)
3021  {
3022  token = pg_strtok(&tokenLength);
3023  s[i] = (char) atoi(token);
3024  }
3025  }
3026  else if (length <= 0)
3027  res = (Datum) NULL;
3028  else
3029  {
3030  s = (char *) palloc(length);
3031  for (i = 0; i < length; i++)
3032  {
3033  token = pg_strtok(&tokenLength);
3034  s[i] = (char) atoi(token);
3035  }
3036  res = PointerGetDatum(s);
3037  }
3038 
3039  token = pg_strtok(&tokenLength); /* read the ']' */
3040  if (token == NULL || token[0] != ']')
3041  elog(ERROR, "expected \"]\" to end datum, but got \"%s\"; length = %zu",
3042  token ? token : "[NULL]", length);
3043 
3044  return res;
3045 }
3046 
3047 /*
3048  * readAttrNumberCols
3049  */
3050 AttrNumber *
3052 {
3053  int tokenLength,
3054  i;
3055  const char *token;
3056  AttrNumber *attr_vals;
3057 
3058  if (numCols <= 0)
3059  return NULL;
3060 
3061  attr_vals = (AttrNumber *) palloc(numCols * sizeof(AttrNumber));
3062  for (i = 0; i < numCols; i++)
3063  {
3064  token = pg_strtok(&tokenLength);
3065  attr_vals[i] = atoi(token);
3066  }
3067 
3068  return attr_vals;
3069 }
3070 
3071 /*
3072  * readOidCols
3073  */
3074 Oid *
3075 readOidCols(int numCols)
3076 {
3077  int tokenLength,
3078  i;
3079  const char *token;
3080  Oid *oid_vals;
3081 
3082  if (numCols <= 0)
3083  return NULL;
3084 
3085  oid_vals = (Oid *) palloc(numCols * sizeof(Oid));
3086  for (i = 0; i < numCols; i++)
3087  {
3088  token = pg_strtok(&tokenLength);
3089  oid_vals[i] = atooid(token);
3090  }
3091 
3092  return oid_vals;
3093 }
3094 
3095 /*
3096  * readIntCols
3097  */
3098 int *
3099 readIntCols(int numCols)
3100 {
3101  int tokenLength,
3102  i;
3103  const char *token;
3104  int *int_vals;
3105 
3106  if (numCols <= 0)
3107  return NULL;
3108 
3109  int_vals = (int *) palloc(numCols * sizeof(int));
3110  for (i = 0; i < numCols; i++)
3111  {
3112  token = pg_strtok(&tokenLength);
3113  int_vals[i] = atoi(token);
3114  }
3115 
3116  return int_vals;
3117 }
3118 
3119 /*
3120  * readBoolCols
3121  */
3122 bool *
3123 readBoolCols(int numCols)
3124 {
3125  int tokenLength,
3126  i;
3127  const char *token;
3128  bool *bool_vals;
3129 
3130  if (numCols <= 0)
3131  return NULL;
3132 
3133  bool_vals = (bool *) palloc(numCols * sizeof(bool));
3134  for (i = 0; i < numCols; i++)
3135  {
3136  token = pg_strtok(&tokenLength);
3137  bool_vals[i] = strtobool(token);
3138  }
3139 
3140  return bool_vals;
3141 }
static NullTest * _readNullTest(void)
Definition: readfuncs.c:1186
static JoinExpr * _readJoinExpr(void)
Definition: readfuncs.c:1343
static RangeVar * _readRangeVar(void)
Definition: readfuncs.c:514
#define atoui(x)
Definition: readfuncs.c:185
static RangeTblEntry * _readRangeTblEntry(void)
Definition: readfuncs.c:1429
static DefElem * _readDefElem(void)
Definition: readfuncs.c:1557
static RowExpr * _readRowExpr(void)
Definition: readfuncs.c:1080
static MergeJoin * _readMergeJoin(void)
Definition: readfuncs.c:2166
static MinMaxExpr * _readMinMaxExpr(void)
Definition: readfuncs.c:1131
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:2421
PartitionPruneCombineOp
Definition: plannodes.h:1260
static Result * _readResult(void)
Definition: readfuncs.c:1651
static Query * _readQuery(void)
Definition: readfuncs.c:247
static RowCompareExpr * _readRowCompareExpr(void)
Definition: readfuncs.c:1097
static Param * _readParam(void)
Definition: readfuncs.c:622
static PlanInvalItem * _readPlanInvalItem(void)
Definition: readfuncs.c:2589
static PartitionPruneInfo * _readPartitionPruneInfo(void)
Definition: readfuncs.c:2531
ParamKind
Definition: primnodes.h:256
static AppendRelInfo * _readAppendRelInfo(void)
Definition: readfuncs.c:1405
static WindowAgg * _readWindowAgg(void)
Definition: readfuncs.c:2331
static IndexScan * _readIndexScan(void)
Definition: readfuncs.c:1860
static NotifyStmt * _readNotifyStmt(void)
Definition: readfuncs.c:298
static Scan * _readScan(void)
Definition: readfuncs.c:1819
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:2463
static CurrentOfExpr * _readCurrentOfExpr(void)
Definition: readfuncs.c:1267
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:999
static SubqueryScan * _readSubqueryScan(void)
Definition: readfuncs.c:1963
BoolTestType
Definition: primnodes.h:1280
#define strtobool(x)
Definition: readfuncs.c:187
static BitmapIndexScan * _readBitmapIndexScan(void)
Definition: readfuncs.c:1900
static CaseExpr * _readCaseExpr(void)
Definition: readfuncs.c:1014
static FunctionScan * _readFunctionScan(void)
Definition: readfuncs.c:1978
static PartitionBoundSpec * _readPartitionBoundSpec(void)
Definition: readfuncs.c:2674
#define READ_BOOL_FIELD(fldname)
Definition: readfuncs.c:117
XmlExprOp
Definition: primnodes.h:1206
QuerySource
Definition: parsenodes.h:40
static void ReadCommonSort(Sort *local_node)
Definition: readfuncs.c:2243
static Unique * _readUnique(void)
Definition: readfuncs.c:2362
static MergeAppend * _readMergeAppend(void)
Definition: readfuncs.c:1732
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:1881
static BitmapAnd * _readBitmapAnd(void)
Definition: readfuncs.c:1774
NullTestType
Definition: primnodes.h:1257
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:1364
static PartitionedRelPruneInfo * _readPartitionedRelPruneInfo(void)
Definition: readfuncs.c:2542
static Aggref * _readAggref(void)
Definition: readfuncs.c:640
SetOpStrategy
Definition: nodes.h:820
static NestLoop * _readNestLoop(void)
Definition: readfuncs.c:2151
OnCommitAction
Definition: primnodes.h:47
static ModifyTable * _readModifyTable(void)
Definition: readfuncs.c:1679
List * colcollations
Definition: primnodes.h:92
static NextValueExpr * _readNextValueExpr(void)
Definition: readfuncs.c:1282
JoinType
Definition: nodes.h:706
static DistinctExpr * _readDistinctExpr(void)
Definition: readfuncs.c:788
Oid * readOidCols(int numCols)
Definition: readfuncs.c:3075
static ArrayCoerceExpr * _readArrayCoerceExpr(void)
Definition: readfuncs.c:964
static TidRangeScan * _readTidRangeScan(void)
Definition: readfuncs.c:1948
static TargetEntry * _readTargetEntry(void)
Definition: readfuncs.c:1311
#define newNode(size, tag)
Definition: nodes.h:577
static void ReadCommonPlan(Plan *local_node)
Definition: readfuncs.c:1613
static Agg * _readAgg(void)
Definition: readfuncs.c:2306
static SeqScan * _readSeqScan(void)
Definition: readfuncs.c:1832
MinMaxOp
Definition: primnodes.h:1139
SetOperation
Definition: parsenodes.h:1631
bool * readBoolCols(int numCols)
Definition: readfuncs.c:3123
static AlternativeSubPlan * _readAlternativeSubPlan(void)
Definition: readfuncs.c:2631
static CteScan * _readCteScan(void)
Definition: readfuncs.c:2024
static GroupingFunc * _readGroupingFunc(void)
Definition: readfuncs.c:671
#define ERROR
Definition: elog.h:46
static CoerceToDomain * _readCoerceToDomain(void)
Definition: readfuncs.c:1217
CTEMaterialize
Definition: parsenodes.h:1465
static SubLink * _readSubLink(void)
Definition: readfuncs.c:874
static HashJoin * _readHashJoin(void)
Definition: readfuncs.c:2191
#define READ_FLOAT_FIELD(fldname)
Definition: readfuncs.c:111
static PartitionPruneStepCombine * _readPartitionPruneStepCombine(void)
Definition: readfuncs.c:2574
static ValuesScan * _readValuesScan(void)
Definition: readfuncs.c:1994
static ConvertRowtypeExpr * _readConvertRowtypeExpr(void)
Definition: readfuncs.c:983
#define READ_OID_ARRAY(fldname, len)
Definition: readfuncs.c:160
static OnConflictExpr * _readOnConflictExpr(void)
Definition: readfuncs.c:1378
RTEKind
Definition: parsenodes.h:976
static NullIfExpr * _readNullIfExpr(void)
Definition: readfuncs.c:808
static Append * _readAppend(void)
Definition: readfuncs.c:1713
static ExtensibleNode * _readExtensibleNode(void)
Definition: readfuncs.c:2644
static PlanRowMark * _readPlanRowMark(void)
Definition: readfuncs.c:2514
static FieldSelect * _readFieldSelect(void)
Definition: readfuncs.c:896
int * readIntCols(int numCols)
Definition: readfuncs.c:3099
void check_stack_depth(void)
Definition: postgres.c:3469
ScanDirection
Definition: sdir.h:22
static CaseWhen * _readCaseWhen(void)
Definition: readfuncs.c:1032
static SQLValueFunction * _readSQLValueFunction(void)
Definition: readfuncs.c:1149
#define READ_CHAR_FIELD(fldname)
Definition: readfuncs.c:98
static IncrementalSort * _readIncrementalSort(void)
Definition: readfuncs.c:2273
AttrNumber * readAttrNumberCols(int numCols)
Definition: readfuncs.c:3051
#define MATCH(tokname, namelen)
#define atooid(x)
Definition: postgres_ext.h:42
static ForeignScan * _readForeignScan(void)
Definition: readfuncs.c:2070
static RelabelType * _readRelabelType(void)
Definition: readfuncs.c:929
WCOKind
Definition: parsenodes.h:1204
static SetOp * _readSetOp(void)
Definition: readfuncs.c:2440
#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:2994
SQLValueFunctionOp
Definition: primnodes.h:1167
static SortGroupClause * _readSortGroupClause(void)
Definition: readfuncs.c:344
#define READ_NODE_FIELD(fldname)
Definition: readfuncs.c:143
SubLinkType
Definition: primnodes.h:681
static Memoize * _readMemoize(void)
Definition: readfuncs.c:2222
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:2479
static PartitionRangeDatum * _readPartitionRangeDatum(void)
Definition: readfuncs.c:2694
LockClauseStrength
Definition: lockoptions.h:21
static void ReadCommonScan(Scan *local_node)
Definition: readfuncs.c:1806
uintptr_t Datum
Definition: postgres.h:411
static void ReadCommonJoin(Join *local_node)
Definition: readfuncs.c:2123
static GatherMerge * _readGatherMerge(void)
Definition: readfuncs.c:2399
static DeclareCursorStmt * _readDeclareCursorStmt(void)
Definition: readfuncs.c:312
static Gather * _readGather(void)
Definition: readfuncs.c:2380
#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
static struct @143 value
RowCompareType
Definition: primnodes.h:1102
static SampleScan * _readSampleScan(void)
Definition: readfuncs.c:1845
static SubPlan * _readSubPlan(void)
Definition: readfuncs.c:2603
#define READ_LOCALS(nodeTypeName)
Definition: readfuncs.c:63
static TidScan * _readTidScan(void)
Definition: readfuncs.c:1933
static CoerceToDomainValue * _readCoerceToDomainValue(void)
Definition: readfuncs.c:1235
static TableFuncScan * _readTableFuncScan(void)
Definition: readfuncs.c:2009
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:1578
static NamedTuplestoreScan * _readNamedTuplestoreScan(void)
Definition: readfuncs.c:2040
XmlOptionType
Definition: primnodes.h:1218
void(* nodeRead)(struct ExtensibleNode *node)
Definition: extensible.h:70
size_t Size
Definition: c.h:540
static Material * _readMaterial(void)
Definition: readfuncs.c:2209
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:1047
RowMarkType
Definition: plannodes.h:1064
static Alias * _readAlias(void)
Definition: readfuncs.c:503
static BitmapOr * _readBitmapOr(void)
Definition: readfuncs.c:1789
static const struct fns functions
Definition: regcomp.c:313
static RangeTblRef * _readRangeTblRef(void)
Definition: readfuncs.c:1330
static RecursiveUnion * _readRecursiveUnion(void)
Definition: readfuncs.c:1754
Bitmapset * bms_add_member(Bitmapset *a, int x)
Definition: bitmapset.c:736
static FieldStore * _readFieldStore(void)
Definition: readfuncs.c:913
static CoalesceExpr * _readCoalesceExpr(void)
Definition: readfuncs.c:1115
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:2714
static SetToDefault * _readSetToDefault(void)
Definition: readfuncs.c:1251
static WithCheckOption * _readWithCheckOption(void)
Definition: readfuncs.c:327
static PartitionPruneStepOp * _readPartitionPruneStepOp(void)
Definition: readfuncs.c:2560
static InferenceElem * _readInferenceElem(void)
Definition: readfuncs.c:1296
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:848
static CustomScan * _readCustomScan(void)
Definition: readfuncs.c:2093
DefElemAction
Definition: parsenodes.h:734
void * arg
static CommonTableExpr * _readCommonTableExpr(void)
Definition: readfuncs.c:456
static ArrayExpr * _readArrayExpr(void)
Definition: readfuncs.c:1062
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
#define READ_INT_FIELD(fldname)
Definition: readfuncs.c:68
Definition: plannodes.h:857
static RangeTblFunction * _readRangeTblFunction(void)
Definition: readfuncs.c:1523
static BooleanTest * _readBooleanTest(void)
Definition: readfuncs.c:1202
static Plan * _readPlan(void)
Definition: readfuncs.c:1638
static XmlExpr * _readXmlExpr(void)
Definition: readfuncs.c:1165
#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:1542
static NestLoopParam * _readNestLoopParam(void)
Definition: readfuncs.c:2500
static ProjectSet * _readProjectSet(void)
Definition: readfuncs.c:1666
OnConflictAction
Definition: nodes.h:832
static BitmapHeapScan * _readBitmapHeapScan(void)
Definition: readfuncs.c:1918
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:2138
static Sort * _readSort(void)
Definition: readfuncs.c:2260
static CoerceViaIO * _readCoerceViaIO(void)
Definition: readfuncs.c:947
static Group * _readGroup(void)
Definition: readfuncs.c:2288
static GroupingSet * _readGroupingSet(void)
Definition: readfuncs.c:361
static WorkTableScan * _readWorkTableScan(void)
Definition: readfuncs.c:2055
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