From: Jeremy Schneider <schneider@ardentperf.com>
To: Rashmi V Bharadwaj <rvbharad@in.ibm.com>
To: pgsql-general@postgresql.org
Subject: Re: PostgreSQL on Amazon RDS
Date: Wed, 8 May 2019 09:54:59 -0700
Message-ID: <68e89318-e125-0ca0-515d-fe96a0c9486e@ardentperf.com> (raw)
In-Reply-To: <OF2BFE9C5B.177E8CE8-ON002583F3.002384AF-002583F3.002384B4@notes.na.collabserv.com>
References: <OF2BFE9C5B.177E8CE8-ON002583F3.002384AF-002583F3.002384B4@notes.na.collabserv.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: schneider@ardentperf.com, rvbharad@in.ibm.com
Subject: Re: PostgreSQL on Amazon RDS
In-Reply-To: <68e89318-e125-0ca0-515d-fe96a0c9486e@ardentperf.com>
References: <OF2BFE9C5B.177E8CE8-ON002583F3.002384AF-002583F3.002384B4@notes.na.collabserv.com> <68e89318-e125-0ca0-515d-fe96a0c9486e@ardentperf.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox