PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
parse_node.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * parse_node.c
4  * various routines that make nodes for querytrees
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/parser/parse_node.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16 
17 #include "access/heapam.h"
18 #include "access/htup_details.h"
19 #include "catalog/pg_type.h"
20 #include "mb/pg_wchar.h"
21 #include "nodes/makefuncs.h"
22 #include "nodes/nodeFuncs.h"
23 #include "parser/parsetree.h"
24 #include "parser/parse_coerce.h"
25 #include "parser/parse_expr.h"
26 #include "parser/parse_relation.h"
27 #include "utils/builtins.h"
28 #include "utils/int8.h"
29 #include "utils/lsyscache.h"
30 #include "utils/syscache.h"
31 #include "utils/varbit.h"
32 
33 
34 static void pcb_error_callback(void *arg);
35 
36 
37 /*
38  * make_parsestate
39  * Allocate and initialize a new ParseState.
40  *
41  * Caller should eventually release the ParseState via free_parsestate().
42  */
43 ParseState *
44 make_parsestate(ParseState *parentParseState)
45 {
46  ParseState *pstate;
47 
48  pstate = palloc0(sizeof(ParseState));
49 
50  pstate->parentParseState = parentParseState;
51 
52  /* Fill in fields that don't start at null/false/zero */
53  pstate->p_next_resno = 1;
54  pstate->p_resolve_unknowns = true;
55 
56  if (parentParseState)
57  {
58  pstate->p_sourcetext = parentParseState->p_sourcetext;
59  /* all hooks are copied from parent */
60  pstate->p_pre_columnref_hook = parentParseState->p_pre_columnref_hook;
61  pstate->p_post_columnref_hook = parentParseState->p_post_columnref_hook;
62  pstate->p_paramref_hook = parentParseState->p_paramref_hook;
63  pstate->p_coerce_param_hook = parentParseState->p_coerce_param_hook;
64  pstate->p_ref_hook_state = parentParseState->p_ref_hook_state;
65  }
66 
67  return pstate;
68 }
69 
70 /*
71  * free_parsestate
72  * Release a ParseState and any subsidiary resources.
73  */
74 void
76 {
77  /*
78  * Check that we did not produce too many resnos; at the very least we
79  * cannot allow more than 2^16, since that would exceed the range of a
80  * AttrNumber. It seems safest to use MaxTupleAttributeNumber.
81  */
82  if (pstate->p_next_resno - 1 > MaxTupleAttributeNumber)
83  ereport(ERROR,
84  (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
85  errmsg("target lists can have at most %d entries",
87 
88  if (pstate->p_target_relation != NULL)
90 
91  pfree(pstate);
92 }
93 
94 
95 /*
96  * parser_errposition
97  * Report a parse-analysis-time cursor position, if possible.
98  *
99  * This is expected to be used within an ereport() call. The return value
100  * is a dummy (always 0, in fact).
101  *
102  * The locations stored in raw parsetrees are byte offsets into the source
103  * string. We have to convert them to 1-based character indexes for reporting
104  * to clients. (We do things this way to avoid unnecessary overhead in the
105  * normal non-error case: computing character indexes would be much more
106  * expensive than storing token offsets.)
107  */
108 int
109 parser_errposition(ParseState *pstate, int location)
110 {
111  int pos;
112 
113  /* No-op if location was not provided */
114  if (location < 0)
115  return 0;
116  /* Can't do anything if source text is not available */
117  if (pstate == NULL || pstate->p_sourcetext == NULL)
118  return 0;
119  /* Convert offset to character number */
120  pos = pg_mbstrlen_with_len(pstate->p_sourcetext, location) + 1;
121  /* And pass it to the ereport mechanism */
122  return errposition(pos);
123 }
124 
125 
126 /*
127  * setup_parser_errposition_callback
128  * Arrange for non-parser errors to report an error position
129  *
130  * Sometimes the parser calls functions that aren't part of the parser
131  * subsystem and can't reasonably be passed a ParseState; yet we would
132  * like any errors thrown in those functions to be tagged with a parse
133  * error location. Use this function to set up an error context stack
134  * entry that will accomplish that. Usage pattern:
135  *
136  * declare a local variable "ParseCallbackState pcbstate"
137  * ...
138  * setup_parser_errposition_callback(&pcbstate, pstate, location);
139  * call function that might throw error;
140  * cancel_parser_errposition_callback(&pcbstate);
141  */
142 void
144  ParseState *pstate, int location)
145 {
146  /* Setup error traceback support for ereport() */
147  pcbstate->pstate = pstate;
148  pcbstate->location = location;
150  pcbstate->errcallback.arg = (void *) pcbstate;
152  error_context_stack = &pcbstate->errcallback;
153 }
154 
155 /*
156  * Cancel a previously-set-up errposition callback.
157  */
158 void
160 {
161  /* Pop the error context stack */
163 }
164 
165 /*
166  * Error context callback for inserting parser error location.
167  *
168  * Note that this will be called for *any* error occurring while the
169  * callback is installed. We avoid inserting an irrelevant error location
170  * if the error is a query cancel --- are there any other important cases?
171  */
172 static void
174 {
175  ParseCallbackState *pcbstate = (ParseCallbackState *) arg;
176 
177  if (geterrcode() != ERRCODE_QUERY_CANCELED)
178  (void) parser_errposition(pcbstate->pstate, pcbstate->location);
179 }
180 
181 
182 /*
183  * make_var
184  * Build a Var node for an attribute identified by RTE and attrno
185  */
186 Var *
187 make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, int location)
188 {
189  Var *result;
190  int vnum,
191  sublevels_up;
192  Oid vartypeid;
193  int32 type_mod;
194  Oid varcollid;
195 
196  vnum = RTERangeTablePosn(pstate, rte, &sublevels_up);
197  get_rte_attribute_type(rte, attrno, &vartypeid, &type_mod, &varcollid);
198  result = makeVar(vnum, attrno, vartypeid, type_mod, varcollid, sublevels_up);
199  result->location = location;
200  return result;
201 }
202 
203 /*
204  * transformArrayType()
205  * Identify the types involved in a subscripting operation
206  *
207  * On entry, arrayType/arrayTypmod identify the type of the input value
208  * to be subscripted (which could be a domain type). These are modified
209  * if necessary to identify the actual array type and typmod, and the
210  * array's element type is returned. An error is thrown if the input isn't
211  * an array type.
212  */
213 Oid
214 transformArrayType(Oid *arrayType, int32 *arrayTypmod)
215 {
216  Oid origArrayType = *arrayType;
217  Oid elementType;
218  HeapTuple type_tuple_array;
219  Form_pg_type type_struct_array;
220 
221  /*
222  * If the input is a domain, smash to base type, and extract the actual
223  * typmod to be applied to the base type. Subscripting a domain is an
224  * operation that necessarily works on the base array type, not the domain
225  * itself. (Note that we provide no method whereby the creator of a
226  * domain over an array type could hide its ability to be subscripted.)
227  */
228  *arrayType = getBaseTypeAndTypmod(*arrayType, arrayTypmod);
229 
230  /*
231  * We treat int2vector and oidvector as though they were domains over
232  * int2[] and oid[]. This is needed because array slicing could create an
233  * array that doesn't satisfy the dimensionality constraints of the
234  * xxxvector type; so we want the result of a slice operation to be
235  * considered to be of the more general type.
236  */
237  if (*arrayType == INT2VECTOROID)
238  *arrayType = INT2ARRAYOID;
239  else if (*arrayType == OIDVECTOROID)
240  *arrayType = OIDARRAYOID;
241 
242  /* Get the type tuple for the array */
243  type_tuple_array = SearchSysCache1(TYPEOID, ObjectIdGetDatum(*arrayType));
244  if (!HeapTupleIsValid(type_tuple_array))
245  elog(ERROR, "cache lookup failed for type %u", *arrayType);
246  type_struct_array = (Form_pg_type) GETSTRUCT(type_tuple_array);
247 
248  /* needn't check typisdefined since this will fail anyway */
249 
250  elementType = type_struct_array->typelem;
251  if (elementType == InvalidOid)
252  ereport(ERROR,
253  (errcode(ERRCODE_DATATYPE_MISMATCH),
254  errmsg("cannot subscript type %s because it is not an array",
255  format_type_be(origArrayType))));
256 
257  ReleaseSysCache(type_tuple_array);
258 
259  return elementType;
260 }
261 
262 /*
263  * transformArraySubscripts()
264  * Transform array subscripting. This is used for both
265  * array fetch and array assignment.
266  *
267  * In an array fetch, we are given a source array value and we produce an
268  * expression that represents the result of extracting a single array element
269  * or an array slice.
270  *
271  * In an array assignment, we are given a destination array value plus a
272  * source value that is to be assigned to a single element or a slice of
273  * that array. We produce an expression that represents the new array value
274  * with the source data inserted into the right part of the array.
275  *
276  * For both cases, if the source array is of a domain-over-array type,
277  * the result is of the base array type or its element type; essentially,
278  * we must fold a domain to its base type before applying subscripting.
279  * (Note that int2vector and oidvector are treated as domains here.)
280  *
281  * pstate Parse state
282  * arrayBase Already-transformed expression for the array as a whole
283  * arrayType OID of array's datatype (should match type of arrayBase,
284  * or be the base type of arrayBase's domain type)
285  * elementType OID of array's element type (fetch with transformArrayType,
286  * or pass InvalidOid to do it here)
287  * arrayTypMod typmod for the array (which is also typmod for the elements)
288  * indirection Untransformed list of subscripts (must not be NIL)
289  * assignFrom NULL for array fetch, else transformed expression for source.
290  */
291 ArrayRef *
293  Node *arrayBase,
294  Oid arrayType,
295  Oid elementType,
296  int32 arrayTypMod,
297  List *indirection,
298  Node *assignFrom)
299 {
300  bool isSlice = false;
301  List *upperIndexpr = NIL;
302  List *lowerIndexpr = NIL;
303  ListCell *idx;
304  ArrayRef *aref;
305 
306  /*
307  * Caller may or may not have bothered to determine elementType. Note
308  * that if the caller did do so, arrayType/arrayTypMod must be as modified
309  * by transformArrayType, ie, smash domain to base type.
310  */
311  if (!OidIsValid(elementType))
312  elementType = transformArrayType(&arrayType, &arrayTypMod);
313 
314  /*
315  * A list containing only simple subscripts refers to a single array
316  * element. If any of the items are slice specifiers (lower:upper), then
317  * the subscript expression means an array slice operation. In this case,
318  * we convert any non-slice items to slices by treating the single
319  * subscript as the upper bound and supplying an assumed lower bound of 1.
320  * We have to prescan the list to see if there are any slice items.
321  */
322  foreach(idx, indirection)
323  {
324  A_Indices *ai = (A_Indices *) lfirst(idx);
325 
326  if (ai->is_slice)
327  {
328  isSlice = true;
329  break;
330  }
331  }
332 
333  /*
334  * Transform the subscript expressions.
335  */
336  foreach(idx, indirection)
337  {
338  A_Indices *ai = castNode(A_Indices, lfirst(idx));
339  Node *subexpr;
340 
341  if (isSlice)
342  {
343  if (ai->lidx)
344  {
345  subexpr = transformExpr(pstate, ai->lidx, pstate->p_expr_kind);
346  /* If it's not int4 already, try to coerce */
347  subexpr = coerce_to_target_type(pstate,
348  subexpr, exprType(subexpr),
349  INT4OID, -1,
352  -1);
353  if (subexpr == NULL)
354  ereport(ERROR,
355  (errcode(ERRCODE_DATATYPE_MISMATCH),
356  errmsg("array subscript must have type integer"),
357  parser_errposition(pstate, exprLocation(ai->lidx))));
358  }
359  else if (!ai->is_slice)
360  {
361  /* Make a constant 1 */
362  subexpr = (Node *) makeConst(INT4OID,
363  -1,
364  InvalidOid,
365  sizeof(int32),
366  Int32GetDatum(1),
367  false,
368  true); /* pass by value */
369  }
370  else
371  {
372  /* Slice with omitted lower bound, put NULL into the list */
373  subexpr = NULL;
374  }
375  lowerIndexpr = lappend(lowerIndexpr, subexpr);
376  }
377  else
378  Assert(ai->lidx == NULL && !ai->is_slice);
379 
380  if (ai->uidx)
381  {
382  subexpr = transformExpr(pstate, ai->uidx, pstate->p_expr_kind);
383  /* If it's not int4 already, try to coerce */
384  subexpr = coerce_to_target_type(pstate,
385  subexpr, exprType(subexpr),
386  INT4OID, -1,
389  -1);
390  if (subexpr == NULL)
391  ereport(ERROR,
392  (errcode(ERRCODE_DATATYPE_MISMATCH),
393  errmsg("array subscript must have type integer"),
394  parser_errposition(pstate, exprLocation(ai->uidx))));
395  }
396  else
397  {
398  /* Slice with omitted upper bound, put NULL into the list */
399  Assert(isSlice && ai->is_slice);
400  subexpr = NULL;
401  }
402  upperIndexpr = lappend(upperIndexpr, subexpr);
403  }
404 
405  /*
406  * If doing an array store, coerce the source value to the right type.
407  * (This should agree with the coercion done by transformAssignedExpr.)
408  */
409  if (assignFrom != NULL)
410  {
411  Oid typesource = exprType(assignFrom);
412  Oid typeneeded = isSlice ? arrayType : elementType;
413  Node *newFrom;
414 
415  newFrom = coerce_to_target_type(pstate,
416  assignFrom, typesource,
417  typeneeded, arrayTypMod,
420  -1);
421  if (newFrom == NULL)
422  ereport(ERROR,
423  (errcode(ERRCODE_DATATYPE_MISMATCH),
424  errmsg("array assignment requires type %s"
425  " but expression is of type %s",
426  format_type_be(typeneeded),
427  format_type_be(typesource)),
428  errhint("You will need to rewrite or cast the expression."),
429  parser_errposition(pstate, exprLocation(assignFrom))));
430  assignFrom = newFrom;
431  }
432 
433  /*
434  * Ready to build the ArrayRef node.
435  */
436  aref = makeNode(ArrayRef);
437  aref->refarraytype = arrayType;
438  aref->refelemtype = elementType;
439  aref->reftypmod = arrayTypMod;
440  /* refcollid will be set by parse_collate.c */
441  aref->refupperindexpr = upperIndexpr;
442  aref->reflowerindexpr = lowerIndexpr;
443  aref->refexpr = (Expr *) arrayBase;
444  aref->refassgnexpr = (Expr *) assignFrom;
445 
446  return aref;
447 }
448 
449 /*
450  * make_const
451  *
452  * Convert a Value node (as returned by the grammar) to a Const node
453  * of the "natural" type for the constant. Note that this routine is
454  * only used when there is no explicit cast for the constant, so we
455  * have to guess what type is wanted.
456  *
457  * For string literals we produce a constant of type UNKNOWN ---- whose
458  * representation is the same as cstring, but it indicates to later type
459  * resolution that we're not sure yet what type it should be considered.
460  * Explicit "NULL" constants are also typed as UNKNOWN.
461  *
462  * For integers and floats we produce int4, int8, or numeric depending
463  * on the value of the number. XXX We should produce int2 as well,
464  * but additional cleanup is needed before we can do that; there are
465  * too many examples that fail if we try.
466  */
467 Const *
468 make_const(ParseState *pstate, Value *value, int location)
469 {
470  Const *con;
471  Datum val;
472  int64 val64;
473  Oid typeid;
474  int typelen;
475  bool typebyval;
476  ParseCallbackState pcbstate;
477 
478  switch (nodeTag(value))
479  {
480  case T_Integer:
481  val = Int32GetDatum(intVal(value));
482 
483  typeid = INT4OID;
484  typelen = sizeof(int32);
485  typebyval = true;
486  break;
487 
488  case T_Float:
489  /* could be an oversize integer as well as a float ... */
490  if (scanint8(strVal(value), true, &val64))
491  {
492  /*
493  * It might actually fit in int32. Probably only INT_MIN can
494  * occur, but we'll code the test generally just to be sure.
495  */
496  int32 val32 = (int32) val64;
497 
498  if (val64 == (int64) val32)
499  {
500  val = Int32GetDatum(val32);
501 
502  typeid = INT4OID;
503  typelen = sizeof(int32);
504  typebyval = true;
505  }
506  else
507  {
508  val = Int64GetDatum(val64);
509 
510  typeid = INT8OID;
511  typelen = sizeof(int64);
512  typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */
513  }
514  }
515  else
516  {
517  /* arrange to report location if numeric_in() fails */
518  setup_parser_errposition_callback(&pcbstate, pstate, location);
520  CStringGetDatum(strVal(value)),
522  Int32GetDatum(-1));
524 
525  typeid = NUMERICOID;
526  typelen = -1; /* variable len */
527  typebyval = false;
528  }
529  break;
530 
531  case T_String:
532 
533  /*
534  * We assume here that UNKNOWN's internal representation is the
535  * same as CSTRING
536  */
537  val = CStringGetDatum(strVal(value));
538 
539  typeid = UNKNOWNOID; /* will be coerced later */
540  typelen = -2; /* cstring-style varwidth type */
541  typebyval = false;
542  break;
543 
544  case T_BitString:
545  /* arrange to report location if bit_in() fails */
546  setup_parser_errposition_callback(&pcbstate, pstate, location);
548  CStringGetDatum(strVal(value)),
550  Int32GetDatum(-1));
552  typeid = BITOID;
553  typelen = -1;
554  typebyval = false;
555  break;
556 
557  case T_Null:
558  /* return a null const */
559  con = makeConst(UNKNOWNOID,
560  -1,
561  InvalidOid,
562  -2,
563  (Datum) 0,
564  true,
565  false);
566  con->location = location;
567  return con;
568 
569  default:
570  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(value));
571  return NULL; /* keep compiler quiet */
572  }
573 
574  con = makeConst(typeid,
575  -1, /* typmod -1 is OK for all cases */
576  InvalidOid, /* all cases are uncollatable types */
577  typelen,
578  val,
579  false,
580  typebyval);
581  con->location = location;
582 
583  return con;
584 }
#define NIL
Definition: pg_list.h:69
Expr * refassgnexpr
Definition: primnodes.h:409
Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod)
Definition: lsyscache.c:2256
#define INT2VECTOROID
Definition: pg_type.h:312
int errhint(const char *fmt,...)
Definition: elog.c:987
#define GETSTRUCT(TUP)
Definition: htup_details.h:656
int exprLocation(const Node *expr)
Definition: nodeFuncs.c:1204
#define MaxTupleAttributeNumber
Definition: htup_details.h:33
#define castNode(_type_, nodeptr)
Definition: nodes.h:575
#define NUMERICOID
Definition: pg_type.h:550
void get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum, Oid *vartype, int32 *vartypmod, Oid *varcollid)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
Definition: parse_expr.c:147
CoerceParamHook p_coerce_param_hook
Definition: parse_node.h:205
#define INT4OID
Definition: pg_type.h:316
Definition: nodes.h:506
#define strVal(v)
Definition: value.h:54
int errcode(int sqlerrcode)
Definition: elog.c:575
int geterrcode(void)
Definition: elog.c:1240
char * format_type_be(Oid type_oid)
Definition: format_type.c:94
Datum idx(PG_FUNCTION_ARGS)
Definition: _int_op.c:264
return result
Definition: formatting.c:1618
#define heap_close(r, l)
Definition: heapam.h:97
ErrorContextCallback errcallback
Definition: parse_node.h:250
FormData_pg_type * Form_pg_type
Definition: pg_type.h:233
unsigned int Oid
Definition: postgres_ext.h:31
Definition: primnodes.h:163
Const * make_const(ParseState *pstate, Value *value, int location)
Definition: parse_node.c:468
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
Definition: makefuncs.c:296
struct ErrorContextCallback * previous
Definition: elog.h:238
#define OidIsValid(objectId)
Definition: c.h:538
#define SearchSysCache1(cacheId, key1)
Definition: syscache.h:152
PostParseColumnRefHook p_post_columnref_hook
Definition: parse_node.h:203
signed int int32
Definition: c.h:256
ParseState * make_parsestate(ParseState *parentParseState)
Definition: parse_node.c:44
int pg_mbstrlen_with_len(const char *mbstr, int limit)
Definition: mbutils.c:805
ErrorContextCallback * error_context_stack
Definition: elog.c:88
static struct @114 value
bool is_slice
Definition: parsenodes.h:373
#define OIDVECTOROID
Definition: pg_type.h:344
void pfree(void *pointer)
Definition: mcxt.c:950
void cancel_parser_errposition_callback(ParseCallbackState *pcbstate)
Definition: parse_node.c:159
#define ObjectIdGetDatum(X)
Definition: postgres.h:513
#define ERROR
Definition: elog.h:43
#define INT2ARRAYOID
Definition: pg_type.h:460
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
Definition: parse_coerce.c:77
Datum bit_in(PG_FUNCTION_ARGS)
Definition: varbit.c:113
bool p_resolve_unknowns
Definition: parse_node.h:188
int location
Definition: primnodes.h:178
#define NoLock
Definition: lockdefs.h:34
ParseParamRefHook p_paramref_hook
Definition: parse_node.h:204
List * refupperindexpr
Definition: primnodes.h:403
List * reflowerindexpr
Definition: primnodes.h:405
#define CStringGetDatum(X)
Definition: postgres.h:584
int p_next_resno
Definition: parse_node.h:183
Datum numeric_in(PG_FUNCTION_ARGS)
Definition: numeric.c:559
const char * p_sourcetext
Definition: parse_node.h:167
Datum Int64GetDatum(int64 X)
Definition: fmgr.c:2152
int32 reftypmod
Definition: primnodes.h:401
#define ereport(elevel, rest)
Definition: elog.h:122
Var * makeVar(Index varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Definition: makefuncs.c:67
void setup_parser_errposition_callback(ParseCallbackState *pcbstate, ParseState *pstate, int location)
Definition: parse_node.c:143
#define DirectFunctionCall3(func, arg1, arg2, arg3)
Definition: fmgr.h:588
List * lappend(List *list, void *datum)
Definition: list.c:128
ParseState * pstate
Definition: parse_node.h:248
struct ParseState * parentParseState
Definition: parse_node.h:166
Oid refelemtype
Definition: primnodes.h:400
#define OIDARRAYOID
Definition: pg_type.h:468
int location
Definition: primnodes.h:203
void * palloc0(Size size)
Definition: mcxt.c:878
uintptr_t Datum
Definition: postgres.h:372
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:1116
ParseExprKind p_expr_kind
Definition: parse_node.h:182
#define InvalidOid
Definition: postgres_ext.h:36
#define INT8OID
Definition: pg_type.h:304
Var * make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, int location)
Definition: parse_node.c:187
#define BITOID
Definition: pg_type.h:538
#define makeNode(_type_)
Definition: nodes.h:554
#define HeapTupleIsValid(tuple)
Definition: htup.h:77
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:675
#define lfirst(lc)
Definition: pg_list.h:106
void * p_ref_hook_state
Definition: parse_node.h:206
Definition: value.h:42
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:42
int parser_errposition(ParseState *pstate, int location)
Definition: parse_node.c:109
Node * lidx
Definition: parsenodes.h:374
#define UNKNOWNOID
Definition: pg_type.h:427
#define nodeTag(nodeptr)
Definition: nodes.h:511
int RTERangeTablePosn(ParseState *pstate, RangeTblEntry *rte, int *sublevels_up)
Oid refarraytype
Definition: primnodes.h:399
Definition: nodes.h:283
Definition: nodes.h:280
#define Int32GetDatum(X)
Definition: postgres.h:485
void(* callback)(void *arg)
Definition: elog.h:239
#define intVal(v)
Definition: value.h:52
Oid transformArrayType(Oid *arrayType, int32 *arrayTypmod)
Definition: parse_node.c:214
int errmsg(const char *fmt,...)
Definition: elog.c:797
Relation p_target_relation
Definition: parse_node.h:178
void * arg
Node * uidx
Definition: parsenodes.h:375
#define elog
Definition: elog.h:219
PreParseColumnRefHook p_pre_columnref_hook
Definition: parse_node.h:202
void free_parsestate(ParseState *pstate)
Definition: parse_node.c:75
Definition: pg_list.h:45
static void pcb_error_callback(void *arg)
Definition: parse_node.c:173
long val
Definition: informix.c:689
ArrayRef * transformArraySubscripts(ParseState *pstate, Node *arrayBase, Oid arrayType, Oid elementType, int32 arrayTypMod, List *indirection, Node *assignFrom)
Definition: parse_node.c:292
int errposition(int cursorpos)
Definition: elog.c:1125
Expr * refexpr
Definition: primnodes.h:407
bool scanint8(const char *str, bool errorOK, int64 *result)
Definition: int8.c:55