Skip to content

Add --no-timings and --no-status - #1637

Open
DiegoDAF wants to merge 4 commits into
dbcli:mainfrom
DiegoDAF:upstream/no-timings-no-status
Open

DiegoDAF wants to merge 4 commits into
dbcli:mainfrom
DiegoDAF:upstream/no-timings-no-status

Conversation

@DiegoDAF

@DiegoDAF DiegoDAF commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

This is item 11 of #1603.

Description

-t/--tuples-only already turns off the timing line and the status footer, but it also drops the column headers, the title and the table formatting, because it matches psql -t. There is currently no way to keep the table intact and suppress only one of the two footers.

That combination is what scripts tend to want. --no-timings alone keeps the status footer, so a wrapper can still read UPDATE 12 back; --no-status alone keeps the timing line, which is handy when timing a query whose output you are eyeballing. Both are off by default, so nothing changes for anyone who does not pass them.

The two flags are independent of each other and of -t, which keeps working as the shorthand for both:

pgcli -c "select 1 as uno"                 table + SELECT 1 + Time: 0.004s
pgcli --no-timings -c "select 1 as uno"    table + SELECT 1
pgcli --no-status  -c "select 1 as uno"    table + Time: 0.004s
pgcli --no-timings --no-status -c "..."    table
pgcli -t -c "select 1 as uno"              1

Implementation is small: --no-timings reuses the pgspecial.timing_enabled switch that -t already flips, and --no-status adds a show_status field to OutputSettings that format_output() checks next to the existing tuples_only check.

8 tests. Two of them fail if the flags are wired to -t rather than standing on their own, which was the mistake worth pinning down.

Errors stay visible. A failed statement's error travels in the same status field as the footer, so --no-status used to drop it and a broken query printed nothing. A failed statement now always keeps its status; two tests against a live server cover it (the first fails without the fix). -t has the same hole on main, fixed separately in #1649; the two changes touch different lines.

Checklist

  • I have added this contribution to the changelog.rst.
  • I have added my name to the AUTHORS file (or it is already there).
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install).
  • Please squash merge this pull request (uncheck if you would like us to merge as multiple commits)

On the third box: .pre-commit-config.yaml pins ruff-pre-commit at v0.11.7 while tox -e style installs ruff unpinned (0.15.x today), and the two disagree on formatting, so the hook reformats code that the style job then wants reformatted back. I ran ruff check and ruff format matching the CI instead, both clean.

-t/--tuples-only already turns off the timing line and the status
footer, but it also drops the headers, the title and the table
formatting. Scripts that post-process pgcli output often want the table
intact and only one of the two footers gone, and there was no way to
ask for that.

The two flags are independent of each other and of -t, which keeps
working as the psql-compatible shorthand for both.

8 tests, 2 of which fail if the flags are wired to -t instead of
standing on their own.
The error of a failed statement travels in the same `status` field as
the "SELECT 3" footer, so --no-status dropped it and a broken query
printed nothing at all. The status of a failed statement is now always
shown; --no-status still drops the footer of a good one.

Two tests against a live server: the error survives --no-status (it
fails without the change), and a good query's footer is still dropped.
The merge of main carried it into the released 4.7.0 section. Also note
that a failed statement still prints its error under --no-status.
diego-feito-stori pushed a commit to DiegoDAF/pgcli.daf that referenced this pull request Oct 15, 2026
DiegoDAF added a commit to DiegoDAF/pgcli.daf that referenced this pull request Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant