PostgreSQL

Popular & Fast Relational Databases

psql Commands

  • End every statement with ;. Otherwise they are not executed
# list postgres commands
\?
 
# list db commands
\h
 
# list users
\du+
 
# list databases
\l
 
# list schemas
\dn
 
# create user
CREATE USER myuser WITH CREATEROLE CREATEDB PASSWORD '1234';
 
# modify table
ALTER TABLE actingentity DROP COLUMN test;
ALTER TABLE actingentity ADD COLUMN test varchar(255);
 
# check if auditing is enabled
SELECT name,setting FROM pg_settings WHERE name LIKE 'pgaudit%';