13

I am trying to enable the transaction logs in PostgreSQL, where query run time is more than 3 seconds, by setting this flag

log_min_duration_statement = 3000

How to reload the configuration file without restarting the Postgres?

I've tried the below options and got these errors

1) postgres=# select pg_reload_config();
**ERROR:  function pg_reload_config() does not exist**
LINE 1: select pg_reload_config();
2) postgres@ospostgresql:/$ /usr/lib/postgresql/11/bin/pg_ctl reload
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.
2
  • 8
    It's pg_reload_conf() - postgresql.org/docs/current/… Commented Mar 1, 2022 at 14:06
  • Thank you so much, I've followed that article only, but I've given the wrong syntax by following genric names like config() Commented Mar 1, 2022 at 14:19

3 Answers 3

21
1) postgres=# select pg_reload_conf();

2) 
    1) su postgres
    2) /usr/lib/postgresql/11/bin/pg_ctl -D /var/lib/postgresql/11/main reload

Incorrect:

select pg_reload_config();
**ERROR:  function pg_reload_config() does not exist**
**-->** This is resolved by giving correct function name

postgres@ospostgresql:/$ /usr/lib/postgresql/11/bin/pg_ctl reload
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.
**-->** This error is resolved by changing the user to postgres

Thank you @a_horse_with_no_name in helping to identify the typo which causes issue-1

Sign up to request clarification or add additional context in comments.

Comments

6

Please use:

SELECT pg_reload_conf();

Or simply:

postgres@server:$ psql -c "SELECT pg_reload_conf()"

Comments

3

The above answer shows 2 ways to do this, but I found that there are 3 different ways to load Postgresql configuration. Apparently systemctl reload postgresql will also work.

Reference: https://www.heatware.net/postgresql/postgresql-reload-config-without-restarting/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.