Skip to content

Releases: DiegoDAF/pgcli.daf

v4.4.4

27 Mar 17:33

Choose a tag to compare

Features

  • SET autocomplete with pg_settings — Typing SET and pressing TAB now suggests PostgreSQL runtime parameters like statement_timeout, work_mem, search_path, etc. Parameters are queried live from the connected server (pg_catalog.pg_settings). Neither pgAdmin nor upstream pgcli have this feature.

Full changelog since v4.4.3

See changelog.rst for the complete history.

pgcli.daf v4.4.2 (upstream: 4.4.0)

18 Mar 14:16

Choose a tag to compare

Changes since v4.3.13

This release includes all changes from v4.3.15 through v4.4.2.

Upstream Compatibility

Compatible with upstream pgcli 4.4.0 — includes all upstream features plus pgcli.daf exclusives.


v4.4.2 (2026-03-02)

Bug Fixes

  • Fix trailing SQL comments causing query execution failure.
    • vacuum freeze verbose t; -- 82% towards emergency now works correctly
    • rstrip(";") failed when a comment followed the semicolon
    • Comments are now stripped before semicolon removal in pgexecute.py
  • Fix multiline mode not submitting queries with trailing comments.
    • _is_complete() in pgbuffer.py now strips comments before checking for a trailing semicolon
    • Previously SELECT 1; -- note would never submit in multiline mode

v4.4.1 (2026-02-24)

Features

  • Add pgcli_isready command — pg_isready wrapper with SSH tunnel support.
  • Complete \restrict meta-command blocking (CVE-2025-8714).
  • Migrate SSH tunnel from sshtunnel to native Paramiko.
    • Eliminates dependency on unmaintained sshtunnel library
    • Allows paramiko >= 3.0 without upper version bound (paramiko 4.x compatible)
    • Refactored main.py to use SSHTunnelManager (eliminated ~115 lines of duplicate code)
  • Add --no-timings and --no-status CLI flags.
  • Change -t/--tuples-only to a pure boolean flag (fixes bug where -t consumed next CLI argument).
  • Read IdentityFile from ~/.ssh/config for SSH tunnel authentication.
  • Configurable SSH host key verification policy (auto-add, warn, reject).
  • Add named query quiet mode \nq to hide query text during execution (upstream dbcli#1551).
  • Add \T prompt escape sequence to display transaction status (upstream dbcli#1553).

Security

  • Sanitize SSH tunnel passwords from debug logs.
  • Mask passwords in --list-dsn output.
  • Use re.fullmatch() for SSH tunnel regex matching (prevents partial hostname matches).
  • Redact PASSWORD clauses from SQL debug logs.
  • Sanitize file paths in \i, \o, and \log-file commands (path traversal prevention).

v4.3.17 (2026-02-13)

Features

  • Add support for \restrict and \unrestrict commands (CVE-2025-8714).

Bug Fixes

  • Fix \np command autocomplete not suggesting named queries.

v4.3.16 (2026-01-20)

Bug Fixes

  • Restore dsn=uri parameter in connect_uri() for proper .pgpass support.

Internal

  • Fix all mypy type checking errors (136 errors resolved).
  • Fix log directory creation to properly create the full path.

v4.3.15 (2026-01-20)

Features

  • Add allow_agent config option in [ssh tunnels] section.
  • Add \nr command to reload named queries without restarting pgcli.
  • Add mypy type checking to CI pipeline and pre-commit hooks.
  • Add autocomplete support for SET ROLE command.

Bug Fixes

  • Fix bash completion showing "includedir" instead of DSN aliases.
  • Fix .pgpass password lookup for pgcli_dump and pgcli_dumpall with SSH tunnels.

v4.3.13

19 Jan 17:31

Choose a tag to compare

Features

  • Add support for organizing DSN aliases in separate files via dsn.d directory
  • Add support for organizing named queries in separate files via namedqueries.d directory
  • Sort named queries alphabetically in \n output for easier navigation

Installation

uv tool install --force "pgcli-4.3.13-py3-none-any.whl[sshtunnel]"

Made with ❤️ and 🤖 Claude

pgcli v4.3.9 - First Forked version.

17 Dec 15:02

Choose a tag to compare

4.3.9 (2025-12-17)

Features:

  • Add support for init-command to run when the connection is established.
    • Command line option --init-command
    • Provide init-command in the config file
    • Support dsn specific init-command in the config file
  • Add suggestion when setting the search_path
  • Allow per dsn_alias ssh tunnel selection
  • 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 support for executing SQL commands from command line.
    • Command line option -c or --command to execute SQL and exit
    • Supports multiple -c options executed sequentially
    • Example: pgcli -c "SELECT 1" -c "SELECT 2"
  • Add support for executing SQL from files.
    • Command line option -f or --file to execute SQL from file and exit
    • Supports multiple files executed in order
    • Example: pgcli -f setup.sql -f data.sql
  • Add tuples-only output mode (psql-compatible).
    • Command line option -t or --tuples-only to print only rows without headers/status
    • Supports custom format: -t minimal, -t simple, etc.
    • Defaults to csv-noheader format
    • Suppresses timing, status messages, and headers
  • Add output file redirection (psql-compatible).
    • Command line option -o or --output to redirect output to file
    • Similar to psql's \o command but from command line
    • Validates file is writable before execution
    • Example: pgcli -o results.txt -c "SELECT * FROM users"
  • Add log rotation support with multiple modes (inspired by PostgreSQL log_filename).
    • Config option log_rotation_mode: none (default), day-of-week, day-of-month, date
    • Config option log_destination: customize log directory location
    • Day-of-week mode creates files like pgcli-Mon.log, overwrites weekly
    • Day-of-month mode creates files like pgcli-01.log, overwrites monthly
    • Date mode creates files like pgcli-20250127.log, never overwrites
    • Backward compatible: defaults to single pgcli.log file when log_rotation_mode = none
  • Enable .pgpass support for SSH tunnel connections
    • Preserve original hostname for .pgpass lookup when using SSH tunnels
    • Use PostgreSQL's hostaddr parameter to specify tunnel endpoint
    • Add SSH configuration options (ssh_config_file, allow_agent, compression)
    • .pgpass file now works seamlessly with --ssh-tunnel option

Internal:

  • Moderize the repository
    • Use uv instead of pip
    • Use github trusted publisher for pypi release
    • Update dev requirements and replace requirements-dev.txt with pyproject.toml
    • Use ruff instead of black

Bug fixes:

  • Improve display of larger durations when passed as floats

Installation

# Install with SSH tunnel support
uv tool install 'pgcli[sshtunnel] @ https://github.com/DiegoDAF/pgcli.dev/releases/download/v4.3.9/pgcli-4.3.9-py3-none-any.whl'

# Or with pip
pip install 'pgcli[sshtunnel] @ https://github.com/DiegoDAF/pgcli.dev/releases/download/v4.3.9/pgcli-4.3.9-py3-none-any.whl'

Configuration Example

Add to ~/.config/pgcli/config:

[main]
# Log rotation mode
log_rotation_mode = day-of-week

# Custom log directory (optional)
log_destination = /var/log/pgcli

# Log level
log_level = INFO

What's Included

This release also includes all v4.3.8 features:

  • -c/--command - Execute SQL from CLI
  • -f/--file - Execute SQL from file
  • -t/--tuples-only - Print only rows without headers
  • -o/--output - Redirect output to file
  • -y/--yes - Skip destructive query confirmations

Testing

  • 5 pytest unit tests for log rotation
  • 4 behave integration tests
  • Full SSH tunnel test coverage

Dependencies

  • paramiko >= 3.0, < 4.0 (sshtunnel compatibility)
  • sshtunnel >= 0.4.0 (for SSH tunnel support)