[PATCH] Warn users about duplicate configuration parameters

Started by Aleksander Alekseevover 9 years ago8 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t36451
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 28, 2026 at 07:13 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t36451_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t36451_1 && git checkout t36451_1

Patchset v1 (message #1) is on t36451_1

Jump to latest
#1Aleksander Alekseev
aleksander@timescale.com

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

Attachments:

t36451_1
duplicate_parameteres.patchtext/x-patchDownload+7-0
#2Andres Freund
andres@anarazel.de
In reply to: Aleksander Alekseev (#1)
Re: [PATCH] Warn users about duplicate configuration parameters

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Tatsuo Ishii
ishii@postgresql.org
In reply to: Andres Freund (#2)
Re: [PATCH] Warn users about duplicate configuration parameters

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Aleksander Alekseev
aleksander@timescale.com
In reply to: Andres Freund (#2)
Re: [PATCH] Warn users about duplicate configuration parameters

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

#5Andres Freund
andres@anarazel.de
In reply to: Aleksander Alekseev (#4)
Re: [PATCH] Warn users about duplicate configuration parameters

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6David Steele
david@pgbackrest.org
In reply to: Tatsuo Ishii (#3)
Re: [PATCH] Warn users about duplicate configuration parameters

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

In reply to: Aleksander Alekseev (#1)
Re: [PATCH] Warn users about duplicate configuration parameters

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
<http://www.timbira.com.br&gt;

#8David G. Johnston
david.g.johnston@gmail.com
In reply to: Aleksander Alekseev (#4)
Re: [PATCH] Warn users about duplicate configuration parameters

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.