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

Function CreateBsonParam

pg_documentdb/src/commands/insert.c:546–564  ·  view source on GitHub ↗

* Creates the Param values for the BSON types. * We do this as a BYTEA param so that Citus can * force the bson as a binary to the worker nodes * which can improve perf in multi-node scenarios. */

Source from the content-addressed store, hash-verified

544 * which can improve perf in multi-node scenarios.
545 */
546inline static Expr *
547CreateBsonParam(int paramIndex, ParamListInfo paramListInfo, pgbson *bsonValue)
548{
549 Assert(paramListInfo->numParams > paramIndex);
550
551 Param *bsonValueParam = makeNode(Param);
552 bsonValueParam->paramid = paramIndex + 1;
553 bsonValueParam->paramkind = PARAM_EXTERN;
554 bsonValueParam->paramtype = BYTEAOID;
555 bsonValueParam->paramtypmod = -1;
556 paramListInfo->params[paramIndex].isnull = false;
557 paramListInfo->params[paramIndex].pflags = PARAM_FLAG_CONST;
558 paramListInfo->params[paramIndex].ptype = BYTEAOID;
559 paramListInfo->params[paramIndex].value = PointerGetDatum(bsonValue);
560 paramIndex++;
561
562 return (Expr *) makeRelabelType((Expr *) bsonValueParam, BsonTypeId(), -1, InvalidOid,
563 COERCE_IMPLICIT_CAST);
564}
565
566
567/*

Callers 2

ProcessInsertionFunction · 0.85

Calls 1

BsonTypeIdFunction · 0.85

Tested by

no test coverage detected