Search code examples
google-cloud-sql

What query can I use to distinguish Cloud SQL from Postgresql?


Is there a simple query that will let me distinguish Cloud SQL from stock PostgreSQL? Maybe something like select version() or select current_setting('server_version')?

(I don't have access to a Cloud SQL instance to experiment.)


Solution

  • For the most part, things are the same. You could try looking for the CLOUDSQLSUPERUSER role, which wouldn't existing on regular postgres (unless you or someone else has added it).

    EDIT: added @enocom's suggestions for a query to do this: select * from pg_catalog.pg_user where usename = 'cloudsqlsuperuser';