| From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> | 
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> | 
| 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-25 01:07:29 | 
| Message-ID: | 20220125010729.GC23027@telsasoft.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Wed, Jan 05, 2022 at 11:36:41PM -0600, Justin Pryzby wrote:
> On Thu, Jan 06, 2022 at 02:19:08PM +0900, Michael Paquier wrote:
> > > +	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
I think you'll find that this is how it's done elsewhere in postgres.
In the frontend, see appendPQExpBufferChar and appendPGArray and 3e6e86abc.
On the backend, see: git grep -F "'{'" |grep -w appendStringInfoChar
I updated the patch with a regex to accommodate GUCs without '=', as needed
since f47ed79cc8.
-- 
Justin
| Attachment | Content-Type | Size | 
|---|---|---|
| 0001-check_guc-fix-absurd-number-of-false-positives.patch | text/x-diff | 3.9 KB | 
| 0002-Expose-GUC-flags-in-SQL-function-retire-.-check_guc.patch | text/x-diff | 15.9 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2022-01-25 01:53:32 | Re: typos | 
| Previous Message | Tom Lane | 2022-01-24 23:29:24 | Re: btree_gist into core? |