You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new structure, kv_list, represents a list of key/value pairs. Its
constructor takes a Postgres `List` argument, iterates over the keys and
values, allocates memory for each, and copies them into the struct. It
uses `malloc()` to allocate the memory, because the we store the value
in a global that mustn't be subject to the GUC memory context.
Use it in `chfdw_settings_assign_hook()` to create a `kv_list` from the
`List` returned by `chfdw_parse_options()` and assign it to the
`ch_session_settings_list` global, which can then be fetched via
`chfdw_get_session_settings()`.
The downside to this approach is that the new value must be parsed
twice. We consider this acceptable, since it means they're no longer
parsed for every query.
While at it, change `chfdw_parse_options()` to use `pstrdup()` instead
of `strdup`, since its memory is handled by a Postgres memory context
(and surely was leaking before).
0 commit comments