---------- * plpgsql_finish_datums Copy completed datum info into function struct. * ---------- */
| 2367 | * ---------- |
| 2368 | */ |
| 2369 | static void |
| 2370 | plpgsql_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 | /* ---------- |
no test coverage detected