-bash-4.2$ psql -U postgres -p 2221
psql (14.11)
Type "help" for help.
postgres=# select datname from pg_database;
datname
-----------
postgres
template1
template0
(3 rows)
postgres=# \l+
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
-----------+----------+----------+-------------+-------------+-----------------------+---------+------------+--------------------------------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 8777 kB | pg_default | default administrative connection database
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 8625 kB | pg_default | unmodifiable empty database
| | | | | postgres=CTc/postgres | | |
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 8625 kB | pg_default | default template for new databases
| | | | | postgres=CTc/postgres | | |
(3 rows)
postgres=# \db+
List of tablespaces
Name | Owner | Location | Access privileges | Options | Size | Description
------------+----------+----------+-------------------+---------+--------+-------------
pg_default | postgres | | | | 25 MB |
pg_global | postgres | | | | 560 kB |
(2 rows)
postgres=# select * from pg_tablespace;
oid | spcname | spcowner | spcacl | spcoptions
------+------------+----------+--------+------------
1663 | pg_default | 10 | |
1664 | pg_global | 10 | |
(2 rows)
postgres=# \du+
List of roles
Role name | Attributes | Member of | Description
-----------+------------------------------------------------------------+-----------+-------------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} |
postgres=# select * from pg_user;
usename | usesysid | usecreatedb | usesuper | userepl | usebypassrls | passwd | valuntil | useconfig
----------+----------+-------------+----------+---------+--------------+----------+----------+-----------
postgres | 10 | t | t | t | t | ******** | |
(1 row)
postgres=# \dn+
List of schemas
Name | Owner | Access privileges | Description
--------+----------+----------------------+------------------------
public | postgres | postgres=UC/postgres+| standard public schema
| | =UC/postgres |
(1 row)
postgres=# create database mdb;
CREATE DATABASE
postgres=#
postgres=#
postgres=# \l+ mdb
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
------+----------+----------+-------------+-------------+-------------------+---------+------------+-------------
mdb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 8625 kB | pg_default |
(1 row)
postgres=# select oid,datname from pg_database;
oid | datname
-------+-----------
14487 | postgres
16384 | mdb
1 | template1
14486 | template0
(4 rows)
postgres=# \c mdb
You are now connected to database "mdb" as user "postgres".
mdb=# \dS+
List of relations
Schema | Name | Type | Owner | Persistence | Access method | Size | Description
------------+---------------------------------+-------+----------+-------------+---------------+------------+-------------
pg_catalog | pg_aggregate | table | postgres | permanent | heap | 56 kB |
pg_catalog | pg_am | table | postgres | permanent | heap | 40 kB |
pg_catalog | pg_amop | table | postgres | permanent | heap | 88 kB |
pg_catalog | pg_amproc | table | postgres | permanent | heap | 72 kB |
pg_catalog | pg_attrdef | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_attribute | table | postgres | permanent | heap | 472 kB |
pg_catalog | pg_auth_members | table | postgres | permanent | heap | 40 kB |
pg_catalog | pg_authid | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_available_extension_versions | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_available_extensions | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_backend_memory_contexts | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_cast | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_class | table | postgres | permanent | heap | 136 kB |
pg_catalog | pg_collation | table | postgres | permanent | heap | 424 kB |
pg_catalog | pg_config | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_constraint | table | postgres | permanent | heap | 64 kB |
pg_catalog | pg_conversion | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_cursors | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_database | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_db_role_setting | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_default_acl | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_depend | table | postgres | permanent | heap | 552 kB |
pg_catalog | pg_description | table | postgres | permanent | heap | 376 kB |
pg_catalog | pg_enum | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_event_trigger | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_extension | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_file_settings | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_foreign_data_wrapper | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_foreign_server | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_foreign_table | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_group | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_hba_file_rules | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_index | table | postgres | permanent | heap | 64 kB |
pg_catalog | pg_indexes | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_inherits | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_init_privs | table | postgres | permanent | heap | 64 kB |
pg_catalog | pg_language | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_largeobject | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_largeobject_metadata | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_locks | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_matviews | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_namespace | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_opclass | table | postgres | permanent | heap | 56 kB |
pg_catalog | pg_operator | table | postgres | permanent | heap | 144 kB |
pg_catalog | pg_opfamily | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_partitioned_table | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_policies | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_policy | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_prepared_statements | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_prepared_xacts | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_proc | table | postgres | permanent | heap | 840 kB |
pg_catalog | pg_publication | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_publication_rel | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_publication_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_range | table | postgres | permanent | heap | 40 kB |
pg_catalog | pg_replication_origin | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_replication_origin_status | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_replication_slots | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_rewrite | table | postgres | permanent | heap | 688 kB |
pg_catalog | pg_roles | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_rules | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_seclabel | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_seclabels | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_sequence | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_sequences | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_settings | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_shadow | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_shdepend | table | postgres | permanent | heap | 40 kB |
pg_catalog | pg_shdescription | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_shmem_allocations | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_shseclabel | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_stat_activity | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_all_indexes | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_all_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_archiver | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_bgwriter | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_database | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_database_conflicts | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_gssapi | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_progress_analyze | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_progress_basebackup | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_progress_cluster | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_progress_copy | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_progress_create_index | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_progress_vacuum | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_replication | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_replication_slots | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_slru | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_ssl | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_subscription | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_sys_indexes | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_sys_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_user_functions | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_user_indexes | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_user_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_wal | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_wal_receiver | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_xact_all_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_xact_sys_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_xact_user_functions | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stat_xact_user_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_all_indexes | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_all_sequences | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_all_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_sys_indexes | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_sys_sequences | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_sys_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_user_indexes | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_user_sequences | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statio_user_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_statistic | table | postgres | permanent | heap | 256 kB |
pg_catalog | pg_statistic_ext | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_statistic_ext_data | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_stats | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stats_ext | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_stats_ext_exprs | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_subscription | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_subscription_rel | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_tables | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_tablespace | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_timezone_abbrevs | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_timezone_names | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_transform | table | postgres | permanent | heap | 0 bytes |
pg_catalog | pg_trigger | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_ts_config | table | postgres | permanent | heap | 40 kB |
pg_catalog | pg_ts_config_map | table | postgres | permanent | heap | 56 kB |
pg_catalog | pg_ts_dict | table | postgres | permanent | heap | 48 kB |
pg_catalog | pg_ts_parser | table | postgres | permanent | heap | 40 kB |
pg_catalog | pg_ts_template | table | postgres | permanent | heap | 40 kB |
pg_catalog | pg_type | table | postgres | permanent | heap | 152 kB |
pg_catalog | pg_user | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_user_mapping | table | postgres | permanent | heap | 8192 bytes |
pg_catalog | pg_user_mappings | view | postgres | permanent | | 0 bytes |
pg_catalog | pg_views | view | postgres | permanent | | 0 bytes |
(134 rows)