Re: Options given both on cmd-line and in the config with different values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Honza Horak <hhorak(at)redhat(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Patrik Novotny <panovotn(at)redhat(dot)com>
Subject: Re: Options given both on cmd-line and in the config with different values
Date: 2021-04-14 17:55:39
Message-ID: 3566642.1618422939@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Honza Horak <hhorak(at)redhat(dot)com> writes:
> I'm trying to understand what is happening in the following bug report:
> https://bugzilla.redhat.com/show_bug.cgi?id=1935301

> The upgrade process makes it a bit more difficult, but it seems to boil
> down to this problem -- even when pg_ctl gets clear guidance where to
> find datadir using -D option on the command-line, it forgets this
> guidance once finding data_directory option in the postgresql.conf.

> Is this the expected behavior actually?

The rule actually is that -D on the command line says where to find
the configuration file. While -D is then also the default for where
to find the data directory, the config file can override that by
giving data_directory explicitly.

This is intended to support situations where the config file is kept
outside the data directory for management reasons. If you are not
actively doing that, I'd recommend *not* setting data_directory
explicitly in the file.

While I've not studied the bug report carefully, it sounds like the
update process you're using involves copying the old config file
across verbatim. You'd at minimum need to filter out data_directory
and related settings to make that safe.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-04-14 17:56:34 Re: Converting contrib SQL functions to new style
Previous Message Tom Lane 2021-04-14 17:41:44 Re: Converting contrib SQL functions to new style