Psql

The psql(1) utility is a simple, terminal-based client for PostgreSQL databases.


Installation

psql(1) is not typically packaged with the core components. For Arch, install the postgresql-libs package. For Alpine or Debian, install the postgresql-client package.


Usage

To open a REPL with a local PostgreSQL database, try:

psql --username=postgres

Aside from SQL queries, there are special commands available in the REPL.

Commands

Command

Meaning

\c [DATABASE]

Connect to [DATABASE]

\d

List tables and relations

\dt

List all tables

\di

List all indices


CategoryRicottone

PostgreSQL/Psql (last edited 2023-04-02 14:56:22 by DominicRicottone)