Re: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name)
| От | Fujii Masao |
|---|---|
| Тема | Re: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name) |
| Дата | |
| Msg-id | 0d5df322-c9ad-308e-982b-a3d3275bcdc0@oss.nttdata.com обсуждение исходный текст |
| Ответ на | RE: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name) ("kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>) |
| Ответы |
RE: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name)
|
| Список | pgsql-hackers |
On 2021/09/01 19:04, kuroda.hayato@fujitsu.com wrote:
> OK, I split and attached like that. 0001 adds new GUC, and
> 0002 allows to accept escapes.
Thanks for splitting and updating the patches!
Here are the comments for 0001 patch.
- /* Use "postgres_fdw" as fallback_application_name. */
+ /* Use GUC paramter if set */
+ if (pgfdw_application_name && *pgfdw_application_name != '\0')
This GUC parameter should be set after the options of foreign server
are set so that its setting can override the server-level ones.
Isn't it better to comment this?
+static bool
+check_pgfdw_application_name(char **newval, void **extra, GucSource source)
+{
+ /* Only allow clean ASCII chars in the application name */
+ if (*newval)
+ pg_clean_ascii(*newval);
+ return true;
Do we really need this check hook? Even without that, any non-ASCII characters
in application_name would be replaced with "?" in the foreign PostgreSQL server
when it's passed to that.
On the other hand, if it's really necessary, application_name set in foreign
server object also needs to be processed in the same way.
+ NULL,
+ PGC_USERSET,
+ GUC_IS_NAME,
Why is GUC_IS_NAME flag necessary?
postgres_fdw.application_name overrides application_name set in foreign server object.
Shouldn't this information be documented?
Isn't it better to have the regression test for this feature?
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
В списке pgsql-hackers по дате отправления: