Skip to content
Release Radar

Postgres CLI with autocompletion and syntax highlighting

v4.7.11 day after v4.7.0
View on GitHub

Release history

v4.7.1

CompareGitHub

Bug fixes:

  • Fix wrong version number that was shown in pgcli --version for version 4.7.0.

Features

  • Add support for single-command to run a SQL command and exit.
    • Command line option -c or --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.
  • Add support for forcing destructive commands without confirmation.
    • Command line option -y or --yes.
    • Skips the destructive command confirmation prompt when enabled.
    • Useful for automated scripts and CI/CD pipelines.
  • Add a -t/--tuples-only command 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 \T still reports it and can still change it mid-session.
  • Add support for executing SQL commands from file and exit.
    • Command line option -f or --file.
    • Multiple files can be specified.
    • Files run one statement at a time, like psql, so a \watch only repeats its own statement (and a bare \watch re-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.

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 words exit/quit, so \q, \d, \i, named queries and \G all failed with syntax 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/--list and --ping discarding the connection string. The positional argument was unconditionally replaced with postgres, which also threw away a connection URI or key=value conninfo (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 to postgres.