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

Function unknown_attribute

src/backend/parser/parse_expr.c:355–399  ·  view source on GitHub ↗

* helper routine for delivering "column does not exist" error message * * (Usually we don't have to work this hard, but the general case of field * selection from an arbitrary node needs it.) */

Source from the content-addressed store, hash-verified

353 * selection from an arbitrary node needs it.)
354 */
355static void
356unknown_attribute(ParseState *pstate, Node *relref, const char *attname,
357 int location)
358{
359 RangeTblEntry *rte;
360
361 if (IsA(relref, Var) &&
362 ((Var *) relref)->varattno == InvalidAttrNumber)
363 {
364 /* Reference the RTE by alias not by actual table name */
365 rte = GetRTEByRangeTablePosn(pstate,
366 ((Var *) relref)->varno,
367 ((Var *) relref)->varlevelsup);
368 ereport(ERROR,
369 (errcode(ERRCODE_UNDEFINED_COLUMN),
370 errmsg("column %s.%s does not exist",
371 rte->eref->aliasname, attname),
372 parser_errposition(pstate, location)));
373 }
374 else
375 {
376 /* Have to do it by reference to the type of the expression */
377 Oid relTypeId = exprType(relref);
378
379 if (ISCOMPLEX(relTypeId))
380 ereport(ERROR,
381 (errcode(ERRCODE_UNDEFINED_COLUMN),
382 errmsg("column \"%s\" not found in data type %s",
383 attname, format_type_be(relTypeId)),
384 parser_errposition(pstate, location)));
385 else if (relTypeId == RECORDOID)
386 ereport(ERROR,
387 (errcode(ERRCODE_UNDEFINED_COLUMN),
388 errmsg("could not identify column \"%s\" in record data type",
389 attname),
390 parser_errposition(pstate, location)));
391 else
392 ereport(ERROR,
393 (errcode(ERRCODE_WRONG_OBJECT_TYPE),
394 errmsg("column notation .%s applied to type %s, "
395 "which is not a composite type",
396 attname, format_type_be(relTypeId)),
397 parser_errposition(pstate, location)));
398 }
399}
400
401static Node *
402transformIndirection(ParseState *pstate, A_Indirection *ind)

Callers 1

transformIndirectionFunction · 0.85

Calls 6

GetRTEByRangeTablePosnFunction · 0.85
parser_errpositionFunction · 0.85
exprTypeFunction · 0.85
format_type_beFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected