Search This Blog

Sunday, February 5, 2023

Most common and useful postgres metacommands

 

Postgres MetaCommands Cheat Sheet

 

Cheat Sheet that serves as a quick reminder of many of the most common and useful metacommands.

 

Meta Command

Description

\l

List Database in current connection to Database

\c <database>

Connect to a database

\dt

List Database Tables

\d <tablename>

Describe Table

\dn

List Schemas

\du

List Users and their Roles

\du <user>

List details about a specific user

\df

List Functions

\dv

List Views

\o <filename>

Save query results to a file

\i <filename>

Execute commands inside a file

\q

Quit psql

 

No comments:

Post a Comment