Skip to content

postgreSQL

RayGutt edited this page Apr 1, 2020 · 1 revision

psql tricks

get info on the current connection:

\conninfo

list databases:

\list

switch database:

\connect dbname
# or
\c dbname

show tables in the current database:

\dt

describe a table:

\d table_name
# or
\d+ table_name

# or, for a simpler output
SELECT
	COLUMN_NAME
FROM
	information_schema.COLUMNS
WHERE
	TABLE_NAME = 'table_name';

Clone this wiki locally