Обсуждение: Check Postgres DB open mode

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

Check Postgres DB open mode

От
Goti
Дата:
Hi Listers,

I am new to postgres and would like to know how to check whether the DB is opened in read write mode or read-only mode.

Thanks,

Goti

Re: Check Postgres DB open mode

От
Holger Jakobs
Дата:
Am 14.07.22 um 06:13 schrieb Goti:
Hi Listers,

I am new to postgres and would like to know how to check whether the DB is opened in read write mode or read-only mode.

Thanks,

Goti

Hi Goti,

The PostgreSQL database isn't "opened", but the clients connect to it.

Whether the connection is read-only can be found out by executing the command

    show transaction_read_only

Unless you are connected to a standby server, connections will be read-write.

Regards,

Holger


-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Вложения

Re: Check Postgres DB open mode

От
Ron
Дата:
On 7/13/22 23:13, Goti wrote:
Hi Listers,

I am new to postgres and would like to know how to check whether the DB is opened in read write mode or read-only mode.

Pedantically, databases are not opened; the postmaster is running or not.  We of course colloquially say that "the database is open" when the postmaster is running.

Locally, you can run the command "pg_ctl status", and systemctl probably also has a status option.

--
Angular momentum makes the world go 'round.