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

Function ProcessGUCArray

src/backend/utils/misc/guc.c:11601–11659  ·  view source on GitHub ↗

* Handle options fetched from pg_db_role_setting.setconfig, * pg_proc.proconfig, etc. Caller must specify proper context/source/action. * * The array parameter must be an array of TEXT (it must not be NULL). */

Source from the content-addressed store, hash-verified

11599 * The array parameter must be an array of TEXT (it must not be NULL).
11600 */
11601void
11602ProcessGUCArray(ArrayType *array,
11603 GucContext context, GucSource source, GucAction action)
11604{
11605 int i;
11606
11607 Assert(array != NULL);
11608 Assert(ARR_ELEMTYPE(array) == TEXTOID);
11609 Assert(ARR_NDIM(array) == 1);
11610 Assert(ARR_LBOUND(array)[0] == 1);
11611
11612 for (i = 1; i <= ARR_DIMS(array)[0]; i++)
11613 {
11614 Datum d;
11615 bool isnull;
11616 char *s;
11617 char *name;
11618 char *value;
11619 char *namecopy;
11620 char *valuecopy;
11621
11622 d = array_ref(array, 1, &i,
11623 -1 /* varlenarray */ ,
11624 -1 /* TEXT's typlen */ ,
11625 false /* TEXT's typbyval */ ,
11626 TYPALIGN_INT /* TEXT's typalign */ ,
11627 &isnull);
11628
11629 if (isnull)
11630 continue;
11631
11632 s = TextDatumGetCString(d);
11633
11634 ParseLongOption(s, &name, &value);
11635 if (!value)
11636 {
11637 ereport(WARNING,
11638 (errcode(ERRCODE_SYNTAX_ERROR),
11639 errmsg("could not parse setting for parameter \"%s\"",
11640 name)));
11641 free(name);
11642 continue;
11643 }
11644
11645 /* free malloc'd strings immediately to avoid leak upon error */
11646 namecopy = pstrdup(name);
11647 free(name);
11648 valuecopy = pstrdup(value);
11649 free(value);
11650
11651 (void) set_config_option(namecopy, valuecopy,
11652 context, source,
11653 action, true, 0, false);
11654
11655 pfree(namecopy);
11656 pfree(valuecopy);
11657 pfree(s);
11658 }

Callers 3

fmgr_security_definerFunction · 0.85
ProcedureCreateFunction · 0.85
ApplySettingFunction · 0.85

Calls 7

array_refFunction · 0.85
ParseLongOptionFunction · 0.85
set_config_optionFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
pstrdupFunction · 0.50
pfreeFunction · 0.50

Tested by

no test coverage detected