Skip to content

psql/mysql filters only fire on the decorated output shape: -A/--csv/-t and mysql batch mode pass through uncapped at any size #4022

Open

Description

@KuSh

rtk psql and rtk mysql only filter the decorated output shape. Every other shape the client can emit is passed through verbatim — no column de-formatting, and crucially no CAP_LIST row cap and no tee recovery hint — at any result size.

The gate is is_table_format, which requires a border line (-+- / ---+--- for psql; the +---+ sniff for mysql). No border, no filter.

Measured against PostgreSQL 16, one 200-row table, same query through rtk psql:

psql mode raw through rtk capped
default (aligned) 204 lines / 5562 B 22 lines / 404 B yes
-A (unaligned) 202 / 4299 203 / 4300 no
--csv 201 / 4288 202 / 4289 no
-t (tuples only) 201 / 5493 202 / 5494 no

The uncapped rows are the point: the one-byte growth is a trailing newline, so a 10k-row psql --csv reaches the agent in full.

The same gap exists for mysql, where it lands on the common path rather than an opt-in one. The client switches to batch mode (tab-separated, no box) whenever stdout is not a tty, which is always the case when rtk runs. Verified on 5.7.44, 8.0.46, 8.4.11 and 9.7.2 — same query, only stdout differing:

stdout = TTY        stdout = PIPE
+---+---+           a	b
| a | b |           1	2
+---+---+
| 1 | 2 |
+---+---+

So rtk mysql -e 'SELECT …' on 200 rows returns all 200, byte-identical to the raw client (4288 → 4289 B).

Capping the undecorated paths is where the unrealised value is for both commands: the row cap plus the tee hint is exactly what the decorated path already does, and it is what an agent running an unbounded SELECT actually needs.

Pre-existing on the psql side; noted while reviewing #3153, which inherits the shape rather than introducing it.

Activity

  1. rtk-wshm-sync-bot commented on Sep 13, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 93%

    Summary

    psql/mysql output filters only trigger on decorated (bordered) output; -A/--csv/-t for psql and mysql's default non-TTY batch mode pass through with no row cap or tee hint, letting large result sets reach the agent uncapped


    Triaged automatically by wshm · This is an automated analysis, not a human review.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions