RE: Allow escape in application_name

Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>

From: "kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>
To: 'Fujii Masao' <masao.fujii@oss.nttdata.com>, 'Kyotaro Horiguchi' <horikyota.ntt@gmail.com>
Cc: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, "ikedamsh@oss.nttdata.com" <ikedamsh@oss.nttdata.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, "tgl@sss.pgh.pa.us" <tgl@sss.pgh.pa.us>
Date: 2021-12-10T07:35:04Z
Lists: pgsql-hackers

Attachments

Dear Fujii-san,

I apologize for sending bad patches...
I confirmed that it can be built and passed a test.

> Could you tell me why you added new paragraph into the middle of existing
> paragraph? This change caused the following error when compiling the docs.
> 
> postgres-fdw.sgml:952: parser error : Opening and ending tag mismatch: listitem
> line 934 and para
>       </para>
> 
> How about adding that new paragraph just after the existing one, instead?

Fixed.

> +				/*
> +				 * The parsing result became an empty string,
> +				 * and that means other "application_name"
> will be used
> +				 * for connecting to the remote server.
> +				 * So we must set values[i] to an empty string
> +				 * and search the array again.	
> +				 */
> +				values[i] = "";
> 
> Isn't pfree() necessary inside the loop also when data[0]=='\0' case? If so,
> probably "data" would need to be set to NULL just after pfree(). Otherwise
> pfree()'d "data" can be pfree()'d again at the end of connect_pg_server().

I confirmed the source, and I agreed your argument because
initStringInfo() allocates memory firstly. Hence pfree() was added.

> Thanks! But, since the term "local server" is already used in the docs, we can use
> "the setting value of application_name in local server" etc?

I like the word "local server," so I reworte descriptions.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED


Commits

  1. postgres_fdw: Add regression test for postgres_fdw.application_name GUC.

  2. postgres_fdw: Allow postgres_fdw.application_name to include escape sequences.

  3. doc: Add note about postgres_fdw.application_name.

  4. postgres_fdw: Revert unstable tests for postgres_fdw.application_name.

  5. postgres_fdw: Allow application_name of remote connection to be set via GUC.