comulinux
5/31/2016 - 7:09 AM

Postgresql command line

Postgresql command line

Dump

Backup:

$ pg_dump -U {user-name} {source_db} -f {dumpfilename.sql}

Restore:

$ psql -U {user-name} -d {desintation_db}-f {dumpfilename.sql}

Connect: $ psql -U {user-name} {source_db}

After connect

List databases:

\l

List tables:

\dt \dt+

Desc table:

\d+ tablename