Обсуждение: [HACKERS] [PATCH] Warn users about duplicate configuration parameters

Поиск
Список
Период
Сортировка

[HACKERS] [PATCH] Warn users about duplicate configuration parameters

От
Aleksander Alekseev
Дата:
Hi.

Recently I've discovered that if there are multiple values of the same
parameter in postgresql.conf PostgreSQL will silently use the last one.
It looks like not the best approach to me. For instance, user can find
the first value in the config file and expect that it will be used, etc.

I suggest to warn users about duplicated parameters. Here is a
corresponding patch.

Thoughts?

--
Best regards,
Aleksander Alekseev

Вложения

Re: [HACKERS] [PATCH] Warn users about duplicate configurationparameters

От
Andres Freund
Дата:
On 2017-04-07 18:14:27 +0300, Aleksander Alekseev wrote:
> Hi.
> 
> Recently I've discovered that if there are multiple values of the same
> parameter in postgresql.conf PostgreSQL will silently use the last one.
> It looks like not the best approach to me. For instance, user can find
> the first value in the config file and expect that it will be used, etc.
> 
> I suggest to warn users about duplicated parameters. Here is a
> corresponding patch.
> 
> Thoughts?

-1 - I frequently just override earlier parameters by adding an include
at the end of the file.  Also, with postgresql.auto.conf it's even more
common to override parameters.


Greetings,

Andres Freund



Re: [HACKERS] [PATCH] Warn users about duplicate configurationparameters

От
Tatsuo Ishii
Дата:
>> Recently I've discovered that if there are multiple values of the same
>> parameter in postgresql.conf PostgreSQL will silently use the last one.
>> It looks like not the best approach to me. For instance, user can find
>> the first value in the config file and expect that it will be used, etc.
>> 
>> I suggest to warn users about duplicated parameters. Here is a
>> corresponding patch.
>> 
>> Thoughts?
> 
> -1 - I frequently just override earlier parameters by adding an include
> at the end of the file.  Also, with postgresql.auto.conf it's even more
> common to override parameters.

-1 from me too by the same reason Andres said.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp



Re: [HACKERS] [PATCH] Warn users about duplicate configurationparameters

От
Aleksander Alekseev
Дата:
Andres, Tatsuo,

Thank you for sharing your thoughts.

> -1 - I frequently just override earlier parameters by adding an
> include at the end of the file.  Also, with postgresql.auto.conf it's
> even more common to override parameters.

> -1 from me too by the same reason Andres said.

I see no problem here. After all, it's just warnings. We can even add
a GUC that disables them specially for experienced users who knows what
she or he is doing. And/or add special case for postgresql.auto.conf.

--
Best regards,
Aleksander Alekseev

Re: [HACKERS] [PATCH] Warn users about duplicate configurationparameters

От
Andres Freund
Дата:
On 2017-04-07 18:29:40 +0300, Aleksander Alekseev wrote:
> Andres, Tatsuo,
> 
> Thank you for sharing your thoughts.
> 
> > -1 - I frequently just override earlier parameters by adding an
> > include at the end of the file.  Also, with postgresql.auto.conf it's
> > even more common to override parameters.
> 
> > -1 from me too by the same reason Andres said.
> 
> I see no problem here. After all, it's just warnings. We can even add
> a GUC that disables them specially for experienced users who knows what
> she or he is doing. And/or add special case for postgresql.auto.conf.

More useless warnings make actual warnings less useful.

Greetings,

Andres Freund



Re: [HACKERS] [PATCH] Warn users about duplicate configurationparameters

От
David Steele
Дата:
On 4/7/17 11:22 AM, Tatsuo Ishii wrote:
>>> Recently I've discovered that if there are multiple values of the same
>>> parameter in postgresql.conf PostgreSQL will silently use the last one.
>>> It looks like not the best approach to me. For instance, user can find
>>> the first value in the config file and expect that it will be used, etc.
>>>
>>> I suggest to warn users about duplicated parameters. Here is a
>>> corresponding patch.
>>>
>>> Thoughts?
>>
>> -1 - I frequently just override earlier parameters by adding an include
>> at the end of the file.  Also, with postgresql.auto.conf it's even more
>> common to override parameters.
> 
> -1 from me too by the same reason Andres said.

-1 from me for the same reason.

-- 
-David
david@pgmasters.net



Re: [HACKERS] [PATCH] Warn users about duplicate configuration parameters

От
Euler Taveira
Дата:
2017-04-07 12:14 GMT-03:00 Aleksander Alekseev <a.alekseev@postgrespro.ru>:
Recently I've discovered that if there are multiple values of the same
parameter in postgresql.conf PostgreSQL will silently use the last one.
It looks like not the best approach to me. For instance, user can find
the first value in the config file and expect that it will be used, etc.

Postgres configuration file concept is based on overriding parameter values. It would be annoying if we emit warning for this feature. Also, it is easier to know which file/line the parameter value came from. You can check for duplicates with a small script.


--
   Euler Taveira                                   Timbira - http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

Re: [HACKERS] [PATCH] Warn users about duplicate configuration parameters

От
"David G. Johnston"
Дата:
On Fri, Apr 7, 2017 at 8:29 AM, Aleksander Alekseev <a.alekseev@postgrespro.ru> wrote:
Andres, Tatsuo,

Thank you for sharing your thoughts.

> -1 - I frequently just override earlier parameters by adding an
> include at the end of the file.  Also, with postgresql.auto.conf it's
> even more common to override parameters.

> -1 from me too by the same reason Andres said.

I see no problem here. After all, it's just warnings. We can even add
a GUC that disables them specially for experienced users who knows what
she or he is doing. And/or add special case for postgresql.auto.conf.


​-1 for learning how the configuration system work via warning messages.

We've recently added pg_file_settings to provide a holistic view and the docs cover the topic quite well.

David J.