MCPcopy Create free account
hub / github.com/apache/cloudberry / transformIndirection

Function transformIndirection

src/backend/parser/parse_expr.c:401–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401static Node *
402transformIndirection(ParseState *pstate, A_Indirection *ind)
403{
404 Node *last_srf = pstate->p_last_srf;
405 Node *result = transformExprRecurse(pstate, ind->arg);
406 List *subscripts = NIL;
407 int location = exprLocation(result);
408 ListCell *i;
409
410 /*
411 * We have to split any field-selection operations apart from
412 * subscripting. Adjacent A_Indices nodes have to be treated as a single
413 * multidimensional subscript operation.
414 */
415 foreach(i, ind->indirection)
416 {
417 Node *n = lfirst(i);
418
419 if (IsA(n, A_Indices))
420 subscripts = lappend(subscripts, n);
421 else if (IsA(n, A_Star))
422 {
423 ereport(ERROR,
424 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
425 errmsg("row expansion via \"*\" is not supported here"),
426 parser_errposition(pstate, location)));
427 }
428 else
429 {
430 Node *newresult;
431
432 Assert(IsA(n, String));
433
434 /* process subscripts before this field selection */
435 if (subscripts)
436 result = (Node *) transformContainerSubscripts(pstate,
437 result,
438 exprType(result),
439 exprTypmod(result),
440 subscripts,
441 false);
442 subscripts = NIL;
443
444 newresult = ParseFuncOrColumn(pstate,
445 list_make1(n),
446 list_make1(result),
447 last_srf,
448 NULL,
449 false,
450 location);
451 if (newresult == NULL)
452 unknown_attribute(pstate, result, strVal(n), location);
453 result = newresult;
454 }
455 }
456 /* process trailing subscripts, if any */
457 if (subscripts)
458 result = (Node *) transformContainerSubscripts(pstate,

Callers 1

transformExprRecurseFunction · 0.85

Calls 12

transformExprRecurseFunction · 0.85
exprLocationFunction · 0.85
lappendFunction · 0.85
parser_errpositionFunction · 0.85
exprTypeFunction · 0.85
exprTypmodFunction · 0.85
ParseFuncOrColumnFunction · 0.85
unknown_attributeFunction · 0.85
foreachFunction · 0.50
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected