Обсуждение: BUG: postgresql.auto.conf location

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

BUG: postgresql.auto.conf location

От
Alexandr Blinov
Дата:
Hello, team!

I’m not sure if this is a bug or not, but the behavior of the postgresql server somewhat confusing.

The postgresql server is started with following parameters:
/usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
hba_file = '/etc/postgresql/9.5/main/pg_hba.conf'
ident_file = '/etc/postgresql/9.5/main/pg_ident.conf'

After that the following command is executed: ‘ALTER SYSTEM SET max_connections = xxx;’

File postgresql.auto.conf is be created at ‘data’ directory, although this is expected in the same directory as the main postgresql.conf file.

This is a confusing, because in case of backup/restore or pg_basebackup to a new server (or new slave server), auto.conf file also will be transferred and applied to a new server, which in some cases is not expected.

Alexandr Blinov 
System Administrator 

T: 41 22 575 2554 | T: 7 495 258 7088 

Av Mon Repos 14 | 1005 Lausanne Switzerland
1-ya Rybinskaya Street 3 107113 Moscow | Russia

www.mysky.com

 
National Winner for Switzerland 2017/2018 European Business Awards

Вложения

Re: BUG: postgresql.auto.conf location

От
"David G. Johnston"
Дата:
On Wed, May 30, 2018 at 10:23 AM, Alexandr Blinov <alexandr.blinov@mysky.com> wrote:
Hello, team!

I’m not sure if this is a bug or not, but the behavior of the postgresql server somewhat confusing.

The postgresql server is started with following parameters:
/usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
hba_file = '/etc/postgresql/9.5/main/pg_hba.conf'
ident_file = '/etc/postgresql/9.5/main/pg_ident.conf'

After that the following command is executed: ‘ALTER SYSTEM SET max_connections = xxx;’

File postgresql.auto.conf is be created at ‘data’ directory, although this is expected in the same directory as the main postgresql.conf file.

The behavior described is intended. 

For the reasons you note not every setting is a candidate to be set in this manner in every situation.

ALTER SYSTEM SET, like ALTER ROLE SET and ALTER DATABASE SET before it, persist its changes as data within the PGDATA directory.  As far as I know nothing you access via SQL will modify (in a controlled manner) the three "files" that you can specify on the postgres command line.  This seems generally sufficient if not desirable.

David J.


Re: BUG: postgresql.auto.conf location

От
Tom Lane
Дата:
Alexandr Blinov <alexandr.blinov@mysky.com> writes:
> After that the following command is executed: ALTER SYSTEM SET max_connections = xxx;'
> File postgresql.auto.conf is be created at 'data' directory, although this is expected in the same directory as the
mainpostgresql.conf file. 

That's intentional, and indeed necessary.  If you are keeping the main
config file in some other place, it's likely that that other place isn't
even writable by the server.

> This is a confusing, because in case of backup/restore or pg_basebackup to a new server (or new slave server),
auto.conffile also will be transferred and applied to a new server, which in some cases is not expected. 

There's been some discussion of teaching those tools to not copy config
files (perhaps optionally?), but I'm not sure what the current status is.

            regards, tom lane