Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

postgresql

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!

like image 826
Hoonerbean Avatar asked Jan 24 '26 20:01

Hoonerbean


1 Answers

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 e.g. 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.