What problem does it solve?
psql is the PostgreSQL interactive terminal; this Skill provides a comprehensive reference and practical guidance to connect, query, manage, and automate PostgreSQL tasks using psql. It reduces guesswork and speeds up DBA and developer workflows by consolidating commands, meta-commands, and scripting patterns.
Core Features & Use Cases
- Meta-Command Reference: Documented 40+ psql backslash commands for databases, schemas, output formatting, file operations, and transactions.
- Connection & Authentication: Guidance on host/port, SSL modes, password files, SSH tunnels, and environment-based credentials.
- SQL & Scripting: Patterns for running queries, scripting with \i, \copy, and batch execution; transaction management and error handling.
- Real-World Scenarios: Examples for exporting data, debugging queries, and automating routine admin tasks.
Quick Start
- Start a session: connect to a database, e.g., psql -h localhost -U postgres -d mydb
- Run an essential command: \dt to list tables or \d+ table to get details
- Execute a simple script: \i script.sql