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

Function plpgsql_finish_datums

src/pl/plpgsql/src/pl_comp.c:2369–2396  ·  view source on GitHub ↗

---------- * plpgsql_finish_datums Copy completed datum info into function struct. * ---------- */

Source from the content-addressed store, hash-verified

2367 * ----------
2368 */
2369static void
2370plpgsql_finish_datums(PLpgSQL_function *function)
2371{
2372 Size copiable_size = 0;
2373 int i;
2374
2375 function->ndatums = plpgsql_nDatums;
2376 function->datums = palloc(sizeof(PLpgSQL_datum *) * plpgsql_nDatums);
2377 for (i = 0; i < plpgsql_nDatums; i++)
2378 {
2379 function->datums[i] = plpgsql_Datums[i];
2380
2381 /* This must agree with copy_plpgsql_datums on what is copiable */
2382 switch (function->datums[i]->dtype)
2383 {
2384 case PLPGSQL_DTYPE_VAR:
2385 case PLPGSQL_DTYPE_PROMISE:
2386 copiable_size += MAXALIGN(sizeof(PLpgSQL_var));
2387 break;
2388 case PLPGSQL_DTYPE_REC:
2389 copiable_size += MAXALIGN(sizeof(PLpgSQL_rec));
2390 break;
2391 default:
2392 break;
2393 }
2394 }
2395 function->copiable_size = copiable_size;
2396}
2397
2398
2399/* ----------

Callers 2

do_compileFunction · 0.85
plpgsql_compile_inlineFunction · 0.85

Calls 1

pallocFunction · 0.50

Tested by

no test coverage detected