You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
run_notebook: row_limit is silently ignored for CTEs, comments, and ; inside literals #595
run_notebook returns every row for database cells whose SQL applyRowLimit does not rewrite. That covers CTEs, SQL with comments, and SQL with ; inside a string or $$ body. Nothing in the result says the limit was skipped, and row_limit is a required field, so agents treat it as a hard cap.
Repro (row_limit 5 on each cell):
SQL
Rows returned
select g from generate_series(1,50) g
5
select g, 'a;b' as s from generate_series(1,50) g
50
with s as (select g from generate_series(1,50) g) select * from s
50
select g from generate_series(1,50) g -- trailing
50
select g, $$a;b$$ as body from generate_series(1,20) g (row_limit 3)
20
Cause: applyRowLimit counts every ; with a regex over the raw text, including ones inside literals. It also deliberately skips CTEs and commented SQL, and nothing truncates rows after the fetch.
Two related problems:
After an oversized cell, later cells are skipped with reason "run result budget spent", even though about 998 KB of budget was unused. The skip itself is documented; only the reason text is wrong.
create_notebook with whitespace-only SQL (" ") fails with "Too small: expected string to have >=1 characters", because the schema trims before checking. That message is misleading for a 3-character input.
Proposed fix:
Lex the SQL with the existing lexSql so ; inside literals doesn't count as a statement break.
Cap the returned rows at row_limit after the fetch.
Use a distinct skip reason after an oversized cell.
Add explicit messages for blank SQL and blank notebook names.
None of this changes tools/list.
Environment: @supabase/mcp-server-supabase 0.19.0 (main at efe189f), local --http transport, Claude Code client.
changed the title [-]`run_notebook` returns every row for database cells whose SQL `applyRowLimit` does not rewrite.[/-][+]run_notebook: row_limit is silently ignored for CTEs, comments, and `;` inside literals[/+]on Nov 22, 2026
Activity
[-]`run_notebook` returns every row for database cells whose SQL `applyRowLimit` does not rewrite.[/-][+]run_notebook: row_limit is silently ignored for CTEs, comments, and `;` inside literals[/+]fix(mcp-server-supabase): match Studio's notebook row_limit and clari…