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

Function ExecBuildSlotValueDescription

src/backend/executor/execMain.c:3365–3495  ·  view source on GitHub ↗

* ExecBuildSlotValueDescription -- construct a string representing a tuple * * This is intentionally very similar to BuildIndexValueDescription, but * unlike that function, we truncate long field values (to at most maxfieldlen * bytes). That seems necessary here since heap field values could be very * long, whereas index entries typically aren't so wide. * * Also, unlike the case with inde

Source from the content-addressed store, hash-verified

3363 * columns they are.
3364 */
3365static char *
3366ExecBuildSlotValueDescription(Oid reloid,
3367 TupleTableSlot *slot,
3368 TupleDesc tupdesc,
3369 Bitmapset *modifiedCols,
3370 int maxfieldlen)
3371{
3372 StringInfoData buf;
3373 StringInfoData collist;
3374 bool write_comma = false;
3375 bool write_comma_collist = false;
3376 int i;
3377 AclResult aclresult;
3378 bool table_perm = false;
3379 bool any_perm = false;
3380
3381 /*
3382 * Check if RLS is enabled and should be active for the relation; if so,
3383 * then don't return anything. Otherwise, go through normal permission
3384 * checks.
3385 */
3386 if (check_enable_rls(reloid, InvalidOid, true) == RLS_ENABLED)
3387 return NULL;
3388
3389 initStringInfo(&buf);
3390
3391 appendStringInfoChar(&buf, '(');
3392
3393 /*
3394 * Check if the user has permissions to see the row. Table-level SELECT
3395 * allows access to all columns. If the user does not have table-level
3396 * SELECT then we check each column and include those the user has SELECT
3397 * rights on. Additionally, we always include columns the user provided
3398 * data for.
3399 */
3400 aclresult = pg_class_aclcheck(reloid, GetUserId(), ACL_SELECT);
3401 if (aclresult != ACLCHECK_OK)
3402 {
3403 /* Set up the buffer for the column list */
3404 initStringInfo(&collist);
3405 appendStringInfoChar(&collist, '(');
3406 }
3407 else
3408 table_perm = any_perm = true;
3409
3410 /* Make sure the tuple is fully deconstructed */
3411 slot_getallattrs(slot);
3412
3413 for (i = 0; i < tupdesc->natts; i++)
3414 {
3415 bool column_perm = false;
3416 char *val;
3417 int vallen;
3418 Form_pg_attribute att = TupleDescAttr(tupdesc, i);
3419
3420 /* ignore dropped columns */
3421 if (att->attisdropped)
3422 continue;

Callers 3

ExecConstraintsFunction · 0.85
ExecWithCheckOptionsFunction · 0.85

Calls 13

check_enable_rlsFunction · 0.85
initStringInfoFunction · 0.85
appendStringInfoCharFunction · 0.85
pg_class_aclcheckFunction · 0.85
GetUserIdFunction · 0.85
slot_getallattrsFunction · 0.85
pg_attribute_aclcheckFunction · 0.85
bms_is_memberFunction · 0.85
appendStringInfoStringFunction · 0.85
getTypeOutputInfoFunction · 0.85
OidOutputFunctionCallFunction · 0.85
appendBinaryStringInfoFunction · 0.85

Tested by

no test coverage detected