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