PostgreSQL Source Code  git master
makefuncs.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * makefuncs.c
4  * creator functions for various nodes. The functions here are for the
5  * most frequently created nodes.
6  *
7  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  *
11  * IDENTIFICATION
12  * src/backend/nodes/makefuncs.c
13  *
14  *-------------------------------------------------------------------------
15  */
16 #include "postgres.h"
17 
18 #include "catalog/pg_class.h"
19 #include "catalog/pg_type.h"
20 #include "nodes/makefuncs.h"
21 #include "nodes/nodeFuncs.h"
22 #include "utils/lsyscache.h"
23 
24 
25 /*
26  * makeA_Expr -
27  * makes an A_Expr node
28  */
29 A_Expr *
31  Node *lexpr, Node *rexpr, int location)
32 {
33  A_Expr *a = makeNode(A_Expr);
34 
35  a->kind = kind;
36  a->name = name;
37  a->lexpr = lexpr;
38  a->rexpr = rexpr;
39  a->location = location;
40  return a;
41 }
42 
43 /*
44  * makeSimpleA_Expr -
45  * As above, given a simple (unqualified) operator name
46  */
47 A_Expr *
49  Node *lexpr, Node *rexpr, int location)
50 {
51  A_Expr *a = makeNode(A_Expr);
52 
53  a->kind = kind;
54  a->name = list_make1(makeString((char *) name));
55  a->lexpr = lexpr;
56  a->rexpr = rexpr;
57  a->location = location;
58  return a;
59 }
60 
61 /*
62  * makeVar -
63  * creates a Var node
64  */
65 Var *
66 makeVar(Index varno,
67  AttrNumber varattno,
68  Oid vartype,
69  int32 vartypmod,
70  Oid varcollid,
71  Index varlevelsup)
72 {
73  Var *var = makeNode(Var);
74 
75  var->varno = varno;
76  var->varattno = varattno;
77  var->vartype = vartype;
78  var->vartypmod = vartypmod;
79  var->varcollid = varcollid;
80  var->varlevelsup = varlevelsup;
81 
82  /*
83  * Only a few callers need to make Var nodes with varnosyn/varattnosyn
84  * different from varno/varattno. We don't provide separate arguments for
85  * them, but just initialize them to the given varno/varattno. This
86  * reduces code clutter and chance of error for most callers.
87  */
88  var->varnosyn = varno;
89  var->varattnosyn = varattno;
90 
91  /* Likewise, we just set location to "unknown" here */
92  var->location = -1;
93 
94  return var;
95 }
96 
97 /*
98  * makeVarFromTargetEntry -
99  * convenience function to create a same-level Var node from a
100  * TargetEntry
101  */
102 Var *
104  TargetEntry *tle)
105 {
106  return makeVar(varno,
107  tle->resno,
108  exprType((Node *) tle->expr),
109  exprTypmod((Node *) tle->expr),
110  exprCollation((Node *) tle->expr),
111  0);
112 }
113 
114 /*
115  * makeWholeRowVar -
116  * creates a Var node representing a whole row of the specified RTE
117  *
118  * A whole-row reference is a Var with varno set to the correct range
119  * table entry, and varattno == 0 to signal that it references the whole
120  * tuple. (Use of zero here is unclean, since it could easily be confused
121  * with error cases, but it's not worth changing now.) The vartype indicates
122  * a rowtype; either a named composite type, or a domain over a named
123  * composite type (only possible if the RTE is a function returning that),
124  * or RECORD. This function encapsulates the logic for determining the
125  * correct rowtype OID to use.
126  *
127  * If allowScalar is true, then for the case where the RTE is a single function
128  * returning a non-composite result type, we produce a normal Var referencing
129  * the function's result directly, instead of the single-column composite
130  * value that the whole-row notation might otherwise suggest.
131  */
132 Var *
134  Index varno,
135  Index varlevelsup,
136  bool allowScalar)
137 {
138  Var *result;
139  Oid toid;
140  Node *fexpr;
141 
142  switch (rte->rtekind)
143  {
144  case RTE_RELATION:
145  /* relation: the rowtype is a named composite type */
146  toid = get_rel_type_id(rte->relid);
147  if (!OidIsValid(toid))
148  ereport(ERROR,
149  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
150  errmsg("relation \"%s\" does not have a composite type",
151  get_rel_name(rte->relid))));
152  result = makeVar(varno,
154  toid,
155  -1,
156  InvalidOid,
157  varlevelsup);
158  break;
159 
160  case RTE_FUNCTION:
161 
162  /*
163  * If there's more than one function, or ordinality is requested,
164  * force a RECORD result, since there's certainly more than one
165  * column involved and it can't be a known named type.
166  */
167  if (rte->funcordinality || list_length(rte->functions) != 1)
168  {
169  /* always produces an anonymous RECORD result */
170  result = makeVar(varno,
172  RECORDOID,
173  -1,
174  InvalidOid,
175  varlevelsup);
176  break;
177  }
178 
179  fexpr = ((RangeTblFunction *) linitial(rte->functions))->funcexpr;
180  toid = exprType(fexpr);
181  if (type_is_rowtype(toid))
182  {
183  /* func returns composite; same as relation case */
184  result = makeVar(varno,
186  toid,
187  -1,
188  InvalidOid,
189  varlevelsup);
190  }
191  else if (allowScalar)
192  {
193  /* func returns scalar; just return its output as-is */
194  result = makeVar(varno,
195  1,
196  toid,
197  -1,
198  exprCollation(fexpr),
199  varlevelsup);
200  }
201  else
202  {
203  /* func returns scalar, but we want a composite result */
204  result = makeVar(varno,
206  RECORDOID,
207  -1,
208  InvalidOid,
209  varlevelsup);
210  }
211  break;
212 
213  default:
214 
215  /*
216  * RTE is a join, subselect, tablefunc, or VALUES. We represent
217  * this as a whole-row Var of RECORD type. (Note that in most
218  * cases the Var will be expanded to a RowExpr during planning,
219  * but that is not our concern here.)
220  */
221  result = makeVar(varno,
223  RECORDOID,
224  -1,
225  InvalidOid,
226  varlevelsup);
227  break;
228  }
229 
230  return result;
231 }
232 
233 /*
234  * makeTargetEntry -
235  * creates a TargetEntry node
236  */
237 TargetEntry *
239  AttrNumber resno,
240  char *resname,
241  bool resjunk)
242 {
244 
245  tle->expr = expr;
246  tle->resno = resno;
247  tle->resname = resname;
248 
249  /*
250  * We always set these fields to 0. If the caller wants to change them he
251  * must do so explicitly. Few callers do that, so omitting these
252  * arguments reduces the chance of error.
253  */
254  tle->ressortgroupref = 0;
255  tle->resorigtbl = InvalidOid;
256  tle->resorigcol = 0;
257 
258  tle->resjunk = resjunk;
259 
260  return tle;
261 }
262 
263 /*
264  * flatCopyTargetEntry -
265  * duplicate a TargetEntry, but don't copy substructure
266  *
267  * This is commonly used when we just want to modify the resno or substitute
268  * a new expression.
269  */
270 TargetEntry *
272 {
274 
275  Assert(IsA(src_tle, TargetEntry));
276  memcpy(tle, src_tle, sizeof(TargetEntry));
277  return tle;
278 }
279 
280 /*
281  * makeFromExpr -
282  * creates a FromExpr node
283  */
284 FromExpr *
285 makeFromExpr(List *fromlist, Node *quals)
286 {
287  FromExpr *f = makeNode(FromExpr);
288 
289  f->fromlist = fromlist;
290  f->quals = quals;
291  return f;
292 }
293 
294 /*
295  * makeConst -
296  * creates a Const node
297  */
298 Const *
299 makeConst(Oid consttype,
300  int32 consttypmod,
301  Oid constcollid,
302  int constlen,
303  Datum constvalue,
304  bool constisnull,
305  bool constbyval)
306 {
307  Const *cnst = makeNode(Const);
308 
309  /*
310  * If it's a varlena value, force it to be in non-expanded (non-toasted)
311  * format; this avoids any possible dependency on external values and
312  * improves consistency of representation, which is important for equal().
313  */
314  if (!constisnull && constlen == -1)
315  constvalue = PointerGetDatum(PG_DETOAST_DATUM(constvalue));
316 
317  cnst->consttype = consttype;
318  cnst->consttypmod = consttypmod;
319  cnst->constcollid = constcollid;
320  cnst->constlen = constlen;
321  cnst->constvalue = constvalue;
322  cnst->constisnull = constisnull;
323  cnst->constbyval = constbyval;
324  cnst->location = -1; /* "unknown" */
325 
326  return cnst;
327 }
328 
329 /*
330  * makeNullConst -
331  * creates a Const node representing a NULL of the specified type/typmod
332  *
333  * This is a convenience routine that just saves a lookup of the type's
334  * storage properties.
335  */
336 Const *
337 makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
338 {
339  int16 typLen;
340  bool typByVal;
341 
342  get_typlenbyval(consttype, &typLen, &typByVal);
343  return makeConst(consttype,
344  consttypmod,
345  constcollid,
346  (int) typLen,
347  (Datum) 0,
348  true,
349  typByVal);
350 }
351 
352 /*
353  * makeBoolConst -
354  * creates a Const node representing a boolean value (can be NULL too)
355  */
356 Node *
357 makeBoolConst(bool value, bool isnull)
358 {
359  /* note that pg_type.h hardwires size of bool as 1 ... duplicate it */
360  return (Node *) makeConst(BOOLOID, -1, InvalidOid, 1,
361  BoolGetDatum(value), isnull, true);
362 }
363 
364 /*
365  * makeBoolExpr -
366  * creates a BoolExpr node
367  */
368 Expr *
370 {
371  BoolExpr *b = makeNode(BoolExpr);
372 
373  b->boolop = boolop;
374  b->args = args;
375  b->location = location;
376 
377  return (Expr *) b;
378 }
379 
380 /*
381  * makeAlias -
382  * creates an Alias node
383  *
384  * NOTE: the given name is copied, but the colnames list (if any) isn't.
385  */
386 Alias *
387 makeAlias(const char *aliasname, List *colnames)
388 {
389  Alias *a = makeNode(Alias);
390 
391  a->aliasname = pstrdup(aliasname);
392  a->colnames = colnames;
393 
394  return a;
395 }
396 
397 /*
398  * makeRelabelType -
399  * creates a RelabelType node
400  */
401 RelabelType *
402 makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, Oid rcollid,
403  CoercionForm rformat)
404 {
406 
407  r->arg = arg;
408  r->resulttype = rtype;
409  r->resulttypmod = rtypmod;
410  r->resultcollid = rcollid;
411  r->relabelformat = rformat;
412  r->location = -1;
413 
414  return r;
415 }
416 
417 /*
418  * makeRangeVar -
419  * creates a RangeVar node (rather oversimplified case)
420  */
421 RangeVar *
422 makeRangeVar(char *schemaname, char *relname, int location)
423 {
424  RangeVar *r = makeNode(RangeVar);
425 
426  r->catalogname = NULL;
427  r->schemaname = schemaname;
428  r->relname = relname;
429  r->inh = true;
430  r->relpersistence = RELPERSISTENCE_PERMANENT;
431  r->alias = NULL;
432  r->location = location;
433 
434  return r;
435 }
436 
437 /*
438  * makeTypeName -
439  * build a TypeName node for an unqualified name.
440  *
441  * typmod is defaulted, but can be changed later by caller.
442  */
443 TypeName *
444 makeTypeName(char *typnam)
445 {
447 }
448 
449 /*
450  * makeTypeNameFromNameList -
451  * build a TypeName node for a String list representing a qualified name.
452  *
453  * typmod is defaulted, but can be changed later by caller.
454  */
455 TypeName *
457 {
458  TypeName *n = makeNode(TypeName);
459 
460  n->names = names;
461  n->typmods = NIL;
462  n->typemod = -1;
463  n->location = -1;
464  return n;
465 }
466 
467 /*
468  * makeTypeNameFromOid -
469  * build a TypeName node to represent a type already known by OID/typmod.
470  */
471 TypeName *
472 makeTypeNameFromOid(Oid typeOid, int32 typmod)
473 {
474  TypeName *n = makeNode(TypeName);
475 
476  n->typeOid = typeOid;
477  n->typemod = typmod;
478  n->location = -1;
479  return n;
480 }
481 
482 /*
483  * makeColumnDef -
484  * build a ColumnDef node to represent a simple column definition.
485  *
486  * Type and collation are specified by OID.
487  * Other properties are all basic to start with.
488  */
489 ColumnDef *
490 makeColumnDef(const char *colname, Oid typeOid, int32 typmod, Oid collOid)
491 {
493 
494  n->colname = pstrdup(colname);
495  n->typeName = makeTypeNameFromOid(typeOid, typmod);
496  n->inhcount = 0;
497  n->is_local = true;
498  n->is_not_null = false;
499  n->is_from_type = false;
500  n->storage = 0;
501  n->raw_default = NULL;
502  n->cooked_default = NULL;
503  n->collClause = NULL;
504  n->collOid = collOid;
505  n->constraints = NIL;
506  n->fdwoptions = NIL;
507  n->location = -1;
508 
509  return n;
510 }
511 
512 /*
513  * makeFuncExpr -
514  * build an expression tree representing a function call.
515  *
516  * The argument expressions must have been transformed already.
517  */
518 FuncExpr *
519 makeFuncExpr(Oid funcid, Oid rettype, List *args,
520  Oid funccollid, Oid inputcollid, CoercionForm fformat)
521 {
522  FuncExpr *funcexpr;
523 
524  funcexpr = makeNode(FuncExpr);
525  funcexpr->funcid = funcid;
526  funcexpr->funcresulttype = rettype;
527  funcexpr->funcretset = false; /* only allowed case here */
528  funcexpr->funcvariadic = false; /* only allowed case here */
529  funcexpr->funcformat = fformat;
530  funcexpr->funccollid = funccollid;
531  funcexpr->inputcollid = inputcollid;
532  funcexpr->args = args;
533  funcexpr->location = -1;
534 
535  return funcexpr;
536 }
537 
538 /*
539  * makeDefElem -
540  * build a DefElem node
541  *
542  * This is sufficient for the "typical" case with an unqualified option name
543  * and no special action.
544  */
545 DefElem *
546 makeDefElem(char *name, Node *arg, int location)
547 {
548  DefElem *res = makeNode(DefElem);
549 
550  res->defnamespace = NULL;
551  res->defname = name;
552  res->arg = arg;
553  res->defaction = DEFELEM_UNSPEC;
554  res->location = location;
555 
556  return res;
557 }
558 
559 /*
560  * makeDefElemExtended -
561  * build a DefElem node with all fields available to be specified
562  */
563 DefElem *
564 makeDefElemExtended(char *nameSpace, char *name, Node *arg,
565  DefElemAction defaction, int location)
566 {
567  DefElem *res = makeNode(DefElem);
568 
569  res->defnamespace = nameSpace;
570  res->defname = name;
571  res->arg = arg;
572  res->defaction = defaction;
573  res->location = location;
574 
575  return res;
576 }
577 
578 /*
579  * makeFuncCall -
580  *
581  * Initialize a FuncCall struct with the information every caller must
582  * supply. Any non-default parameters have to be inserted by the caller.
583  */
584 FuncCall *
585 makeFuncCall(List *name, List *args, int location)
586 {
587  FuncCall *n = makeNode(FuncCall);
588 
589  n->funcname = name;
590  n->args = args;
591  n->agg_order = NIL;
592  n->agg_filter = NULL;
593  n->agg_within_group = false;
594  n->agg_star = false;
595  n->agg_distinct = false;
596  n->func_variadic = false;
597  n->over = NULL;
598  n->location = location;
599  return n;
600 }
601 
602 /*
603  * make_opclause
604  * Creates an operator clause given its operator info, left operand
605  * and right operand (pass NULL to create single-operand clause),
606  * and collation info.
607  */
608 Expr *
609 make_opclause(Oid opno, Oid opresulttype, bool opretset,
610  Expr *leftop, Expr *rightop,
611  Oid opcollid, Oid inputcollid)
612 {
613  OpExpr *expr = makeNode(OpExpr);
614 
615  expr->opno = opno;
616  expr->opfuncid = InvalidOid;
617  expr->opresulttype = opresulttype;
618  expr->opretset = opretset;
619  expr->opcollid = opcollid;
620  expr->inputcollid = inputcollid;
621  if (rightop)
622  expr->args = list_make2(leftop, rightop);
623  else
624  expr->args = list_make1(leftop);
625  expr->location = -1;
626  return (Expr *) expr;
627 }
628 
629 /*
630  * make_andclause
631  *
632  * Creates an 'and' clause given a list of its subclauses.
633  */
634 Expr *
635 make_andclause(List *andclauses)
636 {
637  BoolExpr *expr = makeNode(BoolExpr);
638 
639  expr->boolop = AND_EXPR;
640  expr->args = andclauses;
641  expr->location = -1;
642  return (Expr *) expr;
643 }
644 
645 /*
646  * make_orclause
647  *
648  * Creates an 'or' clause given a list of its subclauses.
649  */
650 Expr *
651 make_orclause(List *orclauses)
652 {
653  BoolExpr *expr = makeNode(BoolExpr);
654 
655  expr->boolop = OR_EXPR;
656  expr->args = orclauses;
657  expr->location = -1;
658  return (Expr *) expr;
659 }
660 
661 /*
662  * make_notclause
663  *
664  * Create a 'not' clause given the expression to be negated.
665  */
666 Expr *
667 make_notclause(Expr *notclause)
668 {
669  BoolExpr *expr = makeNode(BoolExpr);
670 
671  expr->boolop = NOT_EXPR;
672  expr->args = list_make1(notclause);
673  expr->location = -1;
674  return (Expr *) expr;
675 }
676 
677 /*
678  * make_and_qual
679  *
680  * Variant of make_andclause for ANDing two qual conditions together.
681  * Qual conditions have the property that a NULL nodetree is interpreted
682  * as 'true'.
683  *
684  * NB: this makes no attempt to preserve AND/OR flatness; so it should not
685  * be used on a qual that has already been run through prepqual.c.
686  */
687 Node *
688 make_and_qual(Node *qual1, Node *qual2)
689 {
690  if (qual1 == NULL)
691  return qual2;
692  if (qual2 == NULL)
693  return qual1;
694  return (Node *) make_andclause(list_make2(qual1, qual2));
695 }
696 
697 /*
698  * The planner and executor usually represent qualification expressions
699  * as lists of boolean expressions with implicit AND semantics.
700  *
701  * These functions convert between an AND-semantics expression list and the
702  * ordinary representation of a boolean expression.
703  *
704  * Note that an empty list is considered equivalent to TRUE.
705  */
706 Expr *
708 {
709  if (andclauses == NIL)
710  return (Expr *) makeBoolConst(true, false);
711  else if (list_length(andclauses) == 1)
712  return (Expr *) linitial(andclauses);
713  else
714  return make_andclause(andclauses);
715 }
716 
717 List *
719 {
720  /*
721  * NB: because the parser sets the qual field to NULL in a query that has
722  * no WHERE clause, we must consider a NULL input clause as TRUE, even
723  * though one might more reasonably think it FALSE.
724  */
725  if (clause == NULL)
726  return NIL; /* NULL -> NIL list == TRUE */
727  else if (is_andclause(clause))
728  return ((BoolExpr *) clause)->args;
729  else if (IsA(clause, Const) &&
730  !((Const *) clause)->constisnull &&
731  DatumGetBool(((Const *) clause)->constvalue))
732  return NIL; /* constant TRUE input -> NIL list */
733  else
734  return list_make1(clause);
735 }
736 
737 /*
738  * makeIndexInfo
739  * create an IndexInfo node
740  */
741 IndexInfo *
742 makeIndexInfo(int numattrs, int numkeyattrs, Oid amoid, List *expressions,
743  List *predicates, bool unique, bool isready, bool concurrent)
744 {
746 
747  n->ii_NumIndexAttrs = numattrs;
748  n->ii_NumIndexKeyAttrs = numkeyattrs;
749  Assert(n->ii_NumIndexKeyAttrs != 0);
751  n->ii_Unique = unique;
752  n->ii_ReadyForInserts = isready;
753  n->ii_Concurrent = concurrent;
754 
755  /* expressions */
756  n->ii_Expressions = expressions;
758 
759  /* predicates */
760  n->ii_Predicate = predicates;
761  n->ii_PredicateState = NULL;
762 
763  /* exclusion constraints */
764  n->ii_ExclusionOps = NULL;
765  n->ii_ExclusionProcs = NULL;
766  n->ii_ExclusionStrats = NULL;
767 
768  /* opclass options */
769  n->ii_OpclassOptions = NULL;
770 
771  /* speculative inserts */
772  n->ii_UniqueOps = NULL;
773  n->ii_UniqueProcs = NULL;
774  n->ii_UniqueStrats = NULL;
775 
776  /* initialize index-build state to default */
777  n->ii_BrokenHotChain = false;
778  n->ii_ParallelWorkers = 0;
779 
780  /* set up for possible use by index AM */
781  n->ii_Am = amoid;
782  n->ii_AmCache = NULL;
784 
785  return n;
786 }
787 
788 /*
789  * makeGroupingSet
790  *
791  */
792 GroupingSet *
793 makeGroupingSet(GroupingSetKind kind, List *content, int location)
794 {
796 
797  n->kind = kind;
798  n->content = content;
799  n->location = location;
800  return n;
801 }
802 
803 /*
804  * makeVacuumRelation -
805  * create a VacuumRelation node
806  */
808 makeVacuumRelation(RangeVar *relation, Oid oid, List *va_cols)
809 {
811 
812  v->relation = relation;
813  v->oid = oid;
814  v->va_cols = va_cols;
815  return v;
816 }
Datum constvalue
Definition: primnodes.h:214
#define list_make2(x1, x2)
Definition: pg_list.h:229
Value * makeString(char *str)
Definition: value.c:53
signed short int16
Definition: c.h:354
DefElem * makeDefElemExtended(char *nameSpace, char *name, Node *arg, DefElemAction defaction, int location)
Definition: makefuncs.c:564
Oid funcresulttype
Definition: primnodes.h:470
#define NIL
Definition: pg_list.h:65
Expr * make_notclause(Expr *notclause)
Definition: makefuncs.c:667
MemoryContext ii_Context
Definition: execnodes.h:179
Datum boolop(PG_FUNCTION_ARGS)
Definition: _int_bool.c:419
uint16 * ii_UniqueStrats
Definition: execnodes.h:170
FromExpr * makeFromExpr(List *fromlist, Node *quals)
Definition: makefuncs.c:285
Oid typeOid
Definition: parsenodes.h:211
#define IsA(nodeptr, _type_)
Definition: nodes.h:580
Index varlevelsup
Definition: primnodes.h:191
List * ii_Predicate
Definition: execnodes.h:163
List * content
Definition: parsenodes.h:1327
List * names
Definition: parsenodes.h:210
A_Expr_Kind kind
Definition: parsenodes.h:276
bool constbyval
Definition: primnodes.h:217
char storage
Definition: parsenodes.h:653
List * args
Definition: primnodes.h:477
RangeVar * relation
Definition: parsenodes.h:3240
List * colnames
Definition: primnodes.h:43
bool is_local
Definition: parsenodes.h:650
int32 exprTypmod(const Node *expr)
Definition: nodeFuncs.c:275
#define PointerGetDatum(X)
Definition: postgres.h:556
VacuumRelation * makeVacuumRelation(RangeVar *relation, Oid oid, List *va_cols)
Definition: makefuncs.c:808
Oid funccollid
Definition: primnodes.h:475
List * constraints
Definition: parsenodes.h:662
ExprState * ii_PredicateState
Definition: execnodes.h:164
Node * agg_filter
Definition: parsenodes.h:354
char * pstrdup(const char *in)
Definition: mcxt.c:1186
static bool is_andclause(const void *clause)
Definition: nodeFuncs.h:94
Var * makeVarFromTargetEntry(Index varno, TargetEntry *tle)
Definition: makefuncs.c:103
char * defnamespace
Definition: parsenodes.h:731
Expr * arg
Definition: primnodes.h:814
DefElemAction defaction
Definition: parsenodes.h:734
Definition: nodes.h:529
Oid * ii_ExclusionProcs
Definition: execnodes.h:166
Var * makeWholeRowVar(RangeTblEntry *rte, Index varno, Index varlevelsup, bool allowScalar)
Definition: makefuncs.c:133
int errcode(int sqlerrcode)
Definition: elog.c:610
Oid resorigtbl
Definition: primnodes.h:1412
AttrNumber varattno
Definition: primnodes.h:186
bool funcretset
Definition: primnodes.h:471
Node * make_and_qual(Node *qual1, Node *qual2)
Definition: makefuncs.c:688
List * fromlist
Definition: primnodes.h:1510
bool is_not_null
Definition: parsenodes.h:651
bool funcordinality
Definition: parsenodes.h:1064
int location
Definition: parsenodes.h:360
NameData relname
Definition: pg_class.h:38
unsigned int Oid
Definition: postgres_ext.h:31
Expr * make_orclause(List *orclauses)
Definition: makefuncs.c:651
char * resname
Definition: primnodes.h:1409
A_Expr * makeSimpleA_Expr(A_Expr_Kind kind, char *name, Node *lexpr, Node *rexpr, int location)
Definition: makefuncs.c:48
Definition: primnodes.h:181
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
Definition: makefuncs.c:299
#define OidIsValid(objectId)
Definition: c.h:644
Expr * make_opclause(Oid opno, Oid opresulttype, bool opretset, Expr *leftop, Expr *rightop, Oid opcollid, Oid inputcollid)
Definition: makefuncs.c:609
DefElem * makeDefElem(char *name, Node *arg, int location)
Definition: makefuncs.c:546
Oid * ii_UniqueOps
Definition: execnodes.h:168
List * agg_order
Definition: parsenodes.h:353
Node * quals
Definition: primnodes.h:1511
int location
Definition: primnodes.h:584
signed int int32
Definition: c.h:355
Expr * makeBoolExpr(BoolExprType boolop, List *args, int location)
Definition: makefuncs.c:369
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
Definition: makefuncs.c:337
char * schemaname
Definition: primnodes.h:67
GroupingSetKind kind
Definition: parsenodes.h:1326
#define list_make1(x1)
Definition: pg_list.h:227
int location
Definition: primnodes.h:73
int constlen
Definition: primnodes.h:213
Node * cooked_default
Definition: parsenodes.h:655
Alias * makeAlias(const char *aliasname, List *colnames)
Definition: makefuncs.c:387
char * relname
Definition: primnodes.h:68
Oid consttype
Definition: primnodes.h:210
CoercionForm funcformat
Definition: primnodes.h:474
List * ii_ExpressionsState
Definition: execnodes.h:162
Oid opresulttype
Definition: primnodes.h:518
bool resjunk
Definition: primnodes.h:1414
#define linitial(l)
Definition: pg_list.h:195
Oid funcid
Definition: primnodes.h:469
#define ERROR
Definition: elog.h:43
int ii_NumIndexKeyAttrs
Definition: execnodes.h:159
struct WindowDef * over
Definition: parsenodes.h:359
Oid vartype
Definition: primnodes.h:188
BoolExprType boolop
Definition: primnodes.h:582
Node * makeBoolConst(bool value, bool isnull)
Definition: makefuncs.c:357
Oid constcollid
Definition: primnodes.h:212
int location
Definition: primnodes.h:196
Expr * make_andclause(List *andclauses)
Definition: makefuncs.c:635
RelabelType * makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, Oid rcollid, CoercionForm rformat)
Definition: makefuncs.c:402
int location
Definition: primnodes.h:523
Oid * ii_UniqueProcs
Definition: execnodes.h:169
Oid collOid
Definition: parsenodes.h:661
int location
Definition: parsenodes.h:735
List * fdwoptions
Definition: parsenodes.h:663
Node * rexpr
Definition: parsenodes.h:279
AttrNumber resno
Definition: primnodes.h:1408
#define DatumGetBool(X)
Definition: postgres.h:393
int location
Definition: parsenodes.h:280
bool ii_BrokenHotChain
Definition: execnodes.h:175
A_Expr * makeA_Expr(A_Expr_Kind kind, List *name, Node *lexpr, Node *rexpr, int location)
Definition: makefuncs.c:30
MemoryContext CurrentMemoryContext
Definition: mcxt.c:38
int location
Definition: parsenodes.h:664
TargetEntry * flatCopyTargetEntry(TargetEntry *src_tle)
Definition: makefuncs.c:271
IndexInfo * makeIndexInfo(int numattrs, int numkeyattrs, Oid amoid, List *expressions, List *predicates, bool unique, bool isready, bool concurrent)
Definition: makefuncs.c:742
bool type_is_rowtype(Oid typid)
Definition: lsyscache.c:2543
bool ii_ReadyForInserts
Definition: execnodes.h:173
Node * lexpr
Definition: parsenodes.h:278
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
Definition: makefuncs.c:238
Oid opcollid
Definition: primnodes.h:520
Var * makeVar(Index varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Definition: makefuncs.c:66
bool inh
Definition: primnodes.h:69
Node * arg
Definition: parsenodes.h:733
Index varnosyn
Definition: primnodes.h:194
Node * raw_default
Definition: parsenodes.h:654
void * ii_AmCache
Definition: execnodes.h:178
Index varno
Definition: primnodes.h:184
bool func_variadic
Definition: parsenodes.h:358
FuncCall * makeFuncCall(List *name, List *args, int location)
Definition: makefuncs.c:585
int location
Definition: primnodes.h:221
AttrNumber varattnosyn
Definition: primnodes.h:195
uintptr_t Datum
Definition: postgres.h:367
Expr * make_ands_explicit(List *andclauses)
Definition: makefuncs.c:707
int ii_NumIndexAttrs
Definition: execnodes.h:158
List * make_ands_implicit(Expr *clause)
Definition: makefuncs.c:718
Oid opfuncid
Definition: primnodes.h:517
List * typmods
Definition: parsenodes.h:214
Oid get_rel_type_id(Oid relid)
Definition: lsyscache.c:1891
Oid resulttype
Definition: primnodes.h:815
unsigned int Index
Definition: c.h:475
#define BoolGetDatum(X)
Definition: postgres.h:402
TypeName * makeTypeNameFromOid(Oid typeOid, int32 typmod)
Definition: makefuncs.c:472
Oid resultcollid
Definition: primnodes.h:817
#define InvalidOid
Definition: postgres_ext.h:36
TypeName * makeTypeName(char *typnam)
Definition: makefuncs.c:444
static struct @143 value
#define ereport(elevel,...)
Definition: elog.h:144
bool is_from_type
Definition: parsenodes.h:652
bool ii_Unique
Definition: execnodes.h:172
#define makeNode(_type_)
Definition: nodes.h:577
Oid inputcollid
Definition: primnodes.h:476
List * ii_Expressions
Definition: execnodes.h:161
#define Assert(condition)
Definition: c.h:738
char * aliasname
Definition: primnodes.h:42
List * functions
Definition: parsenodes.h:1063
Expr * expr
Definition: primnodes.h:1407
int location
Definition: parsenodes.h:217
A_Expr_Kind
Definition: parsenodes.h:253
int ii_ParallelWorkers
Definition: execnodes.h:176
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:41
List * args
Definition: parsenodes.h:352
static int list_length(const List *l)
Definition: pg_list.h:169
Oid exprCollation(const Node *expr)
Definition: nodeFuncs.c:719
void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval)
Definition: lsyscache.c:2139
int32 typemod
Definition: parsenodes.h:215
TypeName * typeName
Definition: parsenodes.h:648
CollateClause * collClause
Definition: parsenodes.h:660
Oid inputcollid
Definition: primnodes.h:521
List * args
Definition: primnodes.h:583
List * name
Definition: parsenodes.h:277
bool ii_Concurrent
Definition: execnodes.h:174
const char * name
Definition: encode.c:561
#define InvalidAttrNumber
Definition: attnum.h:23
int32 consttypmod
Definition: primnodes.h:211
char relpersistence
Definition: primnodes.h:71
RTEKind rtekind
Definition: parsenodes.h:976
AttrNumber resorigcol
Definition: primnodes.h:1413
Oid * ii_ExclusionOps
Definition: execnodes.h:165
int errmsg(const char *fmt,...)
Definition: elog.c:824
GroupingSet * makeGroupingSet(GroupingSetKind kind, List *content, int location)
Definition: makefuncs.c:793
int inhcount
Definition: parsenodes.h:649
TypeName * makeTypeNameFromNameList(List *names)
Definition: makefuncs.c:456
Oid varcollid
Definition: primnodes.h:190
Index ressortgroupref
Definition: primnodes.h:1410
DefElemAction
Definition: parsenodes.h:720
void * arg
Alias * alias
Definition: primnodes.h:72
#define PG_DETOAST_DATUM(datum)
Definition: fmgr.h:240
GroupingSetKind
Definition: parsenodes.h:1314
char * defname
Definition: parsenodes.h:732
char * colname
Definition: parsenodes.h:647
int32 resulttypmod
Definition: primnodes.h:816
int location
Definition: primnodes.h:478
Oid opno
Definition: primnodes.h:516
List * funcname
Definition: parsenodes.h:351
bool agg_within_group
Definition: parsenodes.h:355
List * args
Definition: primnodes.h:522
uint16 * ii_ExclusionStrats
Definition: execnodes.h:167
CoercionForm relabelformat
Definition: primnodes.h:818
bool agg_distinct
Definition: parsenodes.h:357
CoercionForm
Definition: primnodes.h:456
bool agg_star
Definition: parsenodes.h:356
Definition: pg_list.h:50
char * get_rel_name(Oid relid)
Definition: lsyscache.c:1840
int16 AttrNumber
Definition: attnum.h:21
int location
Definition: primnodes.h:819
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition: makefuncs.c:422
char * catalogname
Definition: primnodes.h:66
Datum * ii_OpclassOptions
Definition: execnodes.h:171
bool constisnull
Definition: primnodes.h:215
bool funcvariadic
Definition: primnodes.h:472
ColumnDef * makeColumnDef(const char *colname, Oid typeOid, int32 typmod, Oid collOid)
Definition: makefuncs.c:490
FuncExpr * makeFuncExpr(Oid funcid, Oid rettype, List *args, Oid funccollid, Oid inputcollid, CoercionForm fformat)
Definition: makefuncs.c:519
bool opretset
Definition: primnodes.h:519
BoolExprType
Definition: primnodes.h:574
Oid ii_Am
Definition: execnodes.h:177
int32 vartypmod
Definition: primnodes.h:189