Golden Codes - armanexplorer planet

Practical code snippets for Django, Python, Bash, Git and All!

View on GitHub

show unique constraints of a table

SELECT conname FROM pg_constraint WHERE conrelid = 'your_table_name'::regclass AND contype = 'u';

show table defintion

\d your_table_name

show verbose table definitoin

\d+ your_table_name

remove unique contraint

ALTER TABLE your_table_name DROP CONSTRAINT constraint_name;

create and drop db

dropdb db_name
createdb db_name

force drop db

dropdb db_name --force