pgcli
DatabasesPostgres CLI with autocompletion and syntax highlighting
v4.7.1
Release history
v4.7.0
GitHub
Features
- Add support for
single-commandto run a SQL command and exit.- Command line option
-cor--command. - You can specify multiple times.
- Runs one statement at a time, like
-f, and can be combined with-f: both run, the same way psql does.
- Command line option
- Add support for forcing destructive commands without confirmation.
- Command line option
-yor--yes. - Skips the destructive command confirmation prompt when enabled.
- Useful for automated scripts and CI/CD pipelines.
- Command line option
- Add a
-t/--tuples-onlycommand line option that prints the rows and nothing else, matching psql: no column headers, no title, no status footer and no timing line. The configured table format is left untouched, so\Tstill reports it and can still change it mid-session. - Add support for executing SQL commands from file and exit.
- Command line option
-for--file. - Multiple files can be specified.
- Files run one statement at a time, like psql, so a
\watchonly repeats its own statement (and a bare\watchre-runs the statement before it), instead of re-running the whole file. A backslash command spans only its own line, also like psql, so a metacommand followed by SQL on the next line does not swallow the SQL.
- Command line option
Bug fixes
- Fix special commands being broken while explain mode (F5) is on. Every input
was prefixed with
EXPLAIN (...)and sent to the server as SQL, including backslash commands and the bare wordsexit/quit, so\q,\d,\i, named queries and\Gall failed withsyntax error at or near "\"and there was no way to leave explain mode or quit. Special commands are now detected first and the EXPLAIN prefix is applied only to real SQL. - Fix
-l/--listand--pingdiscarding the connection string. The positional argument was unconditionally replaced withpostgres, which also threw away a connection URI orkey=valueconninfo (host, user, port,sslmode, everything) and silently fell back to a local socket connection as the OS user. The database argument is now kept, like psql; only when no database is given at all does the listing connect topostgres.
README
This repository has no README.