From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
Cc: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, peter(dot)eisentraut(at)enterprisedb(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, bruce(at)momjian(dot)us, tgl(at)sss(dot)pgh(dot)pa(dot)us |
Subject: | Re: GUC flags |
Date: | 2022-01-06 05:19:08 |
Message-ID: | YdZ7zCymonPV4//X@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jan 05, 2022 at 05:55:17PM -0600, Justin Pryzby wrote:
> pg_settings is currently defined with "SELECT *". Is it fine to enumerate a
> list of columns instead ?
I'd like to think that this is a better practice when it comes
documenting the columns, but I don't see an actual need for this extra
complication here.
> + initStringInfo(&ret);
> + appendStringInfoChar(&ret, '{');
> +
> + if (flags & GUC_NO_SHOW_ALL)
> + appendStringInfo(&ret, "NO_SHOW_ALL,");
> + if (flags & GUC_NO_RESET_ALL)
> + appendStringInfo(&ret, "NO_RESET_ALL,");
> + if (flags & GUC_NOT_IN_SAMPLE)
> + appendStringInfo(&ret, "NOT_IN_SAMPLE,");
> + if (flags & GUC_EXPLAIN)
> + appendStringInfo(&ret, "EXPLAIN,");
> + if (flags & GUC_RUNTIME_COMPUTED)
> + appendStringInfo(&ret, "RUNTIME_COMPUTED,");
> +
> + /* Remove trailing comma, if any */
> + if (ret.len > 1)
> + ret.data[--ret.len] = '\0';
The way of building the text array is incorrect here. See
heap_tuple_infomask_flags() in pageinspect as an example with all the
HEAP_* flags. I think that you should allocate an array of Datums,
use CStringGetTextDatum() to assign each array element, wrapping the
whole with construct_array() to build the final value for the
parameter tuple.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2022-01-06 05:21:15 | Re: Refactoring of compression options in pg_basebackup |
Previous Message | Amit Langote | 2022-01-06 05:16:25 | Re: Delay the variable initialization in get_rel_sync_entry |