I am looking for a bash utility such as mysqladmin that could list all system variables values on the Postgres running instance.
Is there an utility that could be used as mysqladmin : mysqladmin -pxxxxx variables
?
PostgreSQL configuration files are stored in the /etc/postgresql/<version>/main directory. For example, if you install PostgreSQL 12, the configuration files are stored in the /etc/postgresql/12/main directory. To configure IDENT authentication, add entries to the /etc/postgresql/12/main/pg_ident. conf file.
For example, if the database server machine is a remote machine, you will need to set the PGHOST environment variable to the name of the database server machine. The environment variable PGPORT may also have to be set.
In PostgreSQL, a variable is a meaningful name for a memory location. A variable holds a value that can be changed through the block or function. A variable is always associated with a particular data type. Before using a variable, you must declare it in the declaration section of the PostgreSQL Block.
Like, say:
psql -qAtc 'select * from pg_settings';
?
or, if you just want key/value:
psql -qAtc 'SELECT name, setting FROM pg_settings';
?
Note that these will show settings as they apply to the current user running the command. So if there are ALTER DATABASE ... SET ...
or ALTER USER ... SET ...
options in effect you'll see those values, not the underlying ones from postgresql.conf
.
For more details on formatting and control over output, see man psql
.
If you want human-readable output rather than machine-friendly output, use psql -qc
, leaving out the -At
(meaning "unaligned, tuples-only").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With