Обсуждение: Re: PostgreSQL on Amazon RDS

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

Re: PostgreSQL on Amazon RDS

От
Jeremy Schneider
Дата:
On 5/6/19 23:27, Rashmi V Bharadwaj wrote:
> Is there a SQL query or a database parameter setting that I can use from
> an external application to determine if the PostgreSQL database is on
> cloud (like on Amazon RDS or IBM cloud) or on a non-cloud on-prem
> environment?

Here's my psqlrc file which has pretty solid logic for detecting between
Community PostgreSQL, RDS PostgreSQL and Aurora PostgreSQL.  Note that
it just assumes "community/oss" as a default if it doesn't detect the
other two.  Should be easy enough to add detection of other hosted
environments into the query with the "priority" column (as long as
there's a reliable way to detect).

https://gist.github.com/ardentperf/52bd418e44b1be26d7b63af21331cece

This psqlrc also detects read-write versus read-only (e.g. hot standby),
and the usual username/database/superuser info and builds everything
into the prompt in a way that suits me.

-Jeremy

-- 
http://about.me/jeremy_schneider



Re: PostgreSQL on Amazon RDS

От
Alex Aquino
Дата:
Jeremy Schneider - Thanks for that psqlrc file.  Pretty informative. :-)

On Wed, May 8, 2019 at 11:55 AM Jeremy Schneider <schneider@ardentperf.com> wrote:
On 5/6/19 23:27, Rashmi V Bharadwaj wrote:
> Is there a SQL query or a database parameter setting that I can use from
> an external application to determine if the PostgreSQL database is on
> cloud (like on Amazon RDS or IBM cloud) or on a non-cloud on-prem
> environment?

Here's my psqlrc file which has pretty solid logic for detecting between
Community PostgreSQL, RDS PostgreSQL and Aurora PostgreSQL.  Note that
it just assumes "community/oss" as a default if it doesn't detect the
other two.  Should be easy enough to add detection of other hosted
environments into the query with the "priority" column (as long as
there's a reliable way to detect).

https://gist.github.com/ardentperf/52bd418e44b1be26d7b63af21331cece

This psqlrc also detects read-write versus read-only (e.g. hot standby),
and the usual username/database/superuser info and builds everything
into the prompt in a way that suits me.

-Jeremy

--
http://about.me/jeremy_schneider