Skip to content

Instantly share code, notes, and snippets.

@wmedlar
Created August 1, 2019 18:11
Show Gist options
  • Save wmedlar/5b33a00b18c86a45962fd66a16129041 to your computer and use it in GitHub Desktop.
Save wmedlar/5b33a00b18c86a45962fd66a16129041 to your computer and use it in GitHub Desktop.
$ psql -U postgres -h localhost
psql (11.4, server 9.6.13)
Type "help" for help.
postgres=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------+-------------------+----------+------------+------------+-----------------------------------------
cloudsqladmin | cloudsqladmin | UTF8 | en_US.utf8 | en_US.utf8 |
destination | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | cloudsqlsuperuser | UTF8 | en_US.utf8 | en_US.utf8 |
source | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | cloudsqladmin | UTF8 | en_US.utf8 | en_US.utf8 | =c/cloudsqladmin +
| | | | | cloudsqladmin=CTc/cloudsqladmin
template1 | cloudsqlsuperuser | UTF8 | en_US.utf8 | en_US.utf8 | =c/cloudsqlsuperuser +
| | | | | cloudsqlsuperuser=CTc/cloudsqlsuperuser
(6 rows)
postgres=> \c destination
psql (11.4, server 9.6.13)
You are now connected to database "destination" as user "postgres".
destination=> \d
List of relations
Schema | Name | Type | Owner
--------+--------------------+----------+----------
public | application | table | postgres
public | application_id_seq | sequence | postgres
public | policy | table | postgres
public | user | table | postgres
public | user_id_seq | sequence | postgres
(5 rows)
destination=> reassign owned by postgres to ccccccjekvbfghkbbrnfdkrkbtrreggiincehjtjudcd;
REASSIGN OWNED
destination=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------+----------------------------------------------+----------+------------+------------+-----------------------------------------
cloudsqladmin | cloudsqladmin | UTF8 | en_US.utf8 | en_US.utf8 |
destination | ccccccjekvbfghkbbrnfdkrkbtrreggiincehjtjudcd | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | cloudsqlsuperuser | UTF8 | en_US.utf8 | en_US.utf8 |
source | ccccccjekvbfghkbbrnfdkrkbtrreggiincehjtjudcd | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | cloudsqladmin | UTF8 | en_US.utf8 | en_US.utf8 | =c/cloudsqladmin +
| | | | | cloudsqladmin=CTc/cloudsqladmin
template1 | cloudsqlsuperuser | UTF8 | en_US.utf8 | en_US.utf8 | =c/cloudsqlsuperuser +
| | | | | cloudsqlsuperuser=CTc/cloudsqlsuperuser
(6 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment