Replace PG_AUTOCONF_FILENAME with parameter

Started by Jonathan Jacobsonover 7 years ago3 messages
#1Jonathan Jacobson
jonjac@gmail.com

As opposed to config_file, hba_file, etc. the name and location of the
autoconfig file is fixed to $PGDATA/postgresql.auto.conf (guc.h)

The static name also appears in some other locations, such as
pg_basebackup, pg_rewind & initdb.c.

New feature suggestion: Allow to set the file's location, as with hba_file
and ident_file.

Would be glad to make it my contribution to the code.

#2Michael Paquier
michael@paquier.xyz
In reply to: Jonathan Jacobson (#1)
Re: Replace PG_AUTOCONF_FILENAME with parameter

On Fri, Oct 05, 2018 at 09:39:03AM +0300, Jonathan Jacobson wrote:

As opposed to config_file, hba_file, etc. the name and location of the
autoconfig file is fixed to $PGDATA/postgresql.auto.conf (guc.h)

The static name also appears in some other locations, such as
pg_basebackup, pg_rewind & initdb.c.

New feature suggestion: Allow to set the file's location, as with hba_file
and ident_file.

Would be glad to make it my contribution to the code.

Could you explain what is your use-case? postgresql.auto.conf is used
internally by Postgres to store information from ALTER SYSTEM, and is
not something aimed at being available externally.
--
Michael

#3Andrew Gierth
andrew@tao11.riddles.org.uk
In reply to: Jonathan Jacobson (#1)
Re: Replace PG_AUTOCONF_FILENAME with parameter

"Jonathan" == Jonathan Jacobson <jonjac@gmail.com> writes:

Jonathan> As opposed to config_file, hba_file, etc. the name and
Jonathan> location of the autoconfig file is fixed to
Jonathan> $PGDATA/postgresql.auto.conf (guc.h)

The reason it's in a fixed location is that the server needs to be able
to rewrite the file, and we don't assume we can write to directories
outside of $PGDATA unless the _directory_ (not the file) was explicitly
specified (e.g. unix_socket_directories or stats_temp_directory).

hba_file and ident_file can be outside $PGDATA because the server never
needs to write to them.

--
Andrew (irc:RhodiumToad)