sudo -u postgres psql
connect to database xxx
\c xxx
list all tables in the current database
\dt
list all tables and indexes in current database
\d
list column yyy detail
\d yyy
drop table xxx and yyy in current database
drop table xxx, yyy;
drop xxx database
DROP DATABASE "xxx";
show postgres version
select version();
show current database
SELECT current_database();
connection info
\conninfo
rename database
ALTER DATABASE oldame RENAME TO newname;
clone database
CREATE DATABASE newdb WITH TEMPLATE originaldb;