MCPcopy Create free account
hub / github.com/documentdb/documentdb / IsCurrentScanDocumentVar

Function IsCurrentScanDocumentVar

pg_documentdb/src/opclass/index_support.c:1525–1540  ·  view source on GitHub ↗

Returns true if var is the document column of the relation this scan path is for. */

Source from the content-addressed store, hash-verified

1523
1524/* Returns true if var is the document column of the relation this scan path is for. */
1525static bool
1526IsCurrentScanDocumentVar(Var *var, PlannerInfo *root, Index scanRti)
1527{
1528 /* Requires a local BSON Var from the same query source as the scan path,
1529 * then confirm that source is a real relation (not a CTE or subquery).
1530 */
1531 if (var->varlevelsup != 0 ||
1532 var->varno != (int) scanRti ||
1533 var->varattno != DOCUMENT_DATA_TABLE_DOCUMENT_VAR_ATTR_NUMBER ||
1534 (var->vartype != BsonTypeId() && var->vartype != DocumentDBCoreBsonTypeId()))
1535 {
1536 return false;
1537 }
1538
1539 return planner_rt_fetch(var->varno, root)->rtekind == RTE_RELATION;
1540}
1541
1542
1543static bool

Callers 2

CheckFieldCoverageFunction · 0.85

Calls 2

BsonTypeIdFunction · 0.85
DocumentDBCoreBsonTypeIdFunction · 0.85

Tested by

no test coverage detected