简体   繁体   中英

How do you view the configuration settings of a PostgreSQL database?

I'm running PostgreSQL 10.2 and I'm trying to learn about logging. I've read that I can set the configuration for an individual database following this documentation:

https://www.postgresql.org/docs/10/manage-ag-config.html

But after I make a configuration change to a database, how do I check/view what the current settings are? I can't seem to find documentation on this.

Thanks!

All settings are exposed through pg_settings

So you can query it:

select *
from pg_settings
where name like '%log%';

If you change a setting for one specific database, that value will show up in pg_settings . The source column's value "database" will indicate that the configuration value was set on database level. The value "user" will indicate it was set on the current user's level.

A short version of that is show

show log_destination;

Or you can use current_setting()

As eg the setting for the logfile might contain placeholders, you can query the active value through the function pg_current_logfile()

Many configuration settings can be changed online, but you need to "activate" them by reloading the configuration using pg_reload_conf()

Note that some settings are only visible to the superuser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM