Skip to content

fix(sql): skip destructive confirmation for planner-only EXPLAIN - #519

Merged
Rodriguespn merged 2 commits into
mainfrom
Rodriguespn/ai-1431-explain-no-elicit
Nov 5, 2026
Merged

Rodriguespn merged 2 commits into
mainfrom
Rodriguespn/ai-1431-explain-no-elicit

Conversation

@Rodriguespn

Copy link
Copy Markdown
Contributor

execute_sql and apply_migration asked for destructive-SQL confirmation on EXPLAIN statements that only plan. The classifier split on every ;, including ones inside string literals, so EXPLAIN (ANALYZE FALSE, FORMAT JSON) SELECT '...; DELETE FROM t;'::text prompted. The prompt expired and the read-only diagnostic failed (AI-1424).

Postgres only runs the explained statement under ANALYZE (docs), so:

  • No confirmation when every statement is an EXPLAIN without ANALYZE: bare, VERBOSE, option lists, or ANALYZE FALSE|OFF|0.
  • EXPLAIN ANALYZE (all forms) now classifies the statement it runs. EXPLAIN ANALYZE DELETE FROM t did not prompt before; it does now.
  • EXPLAIN SELECT 1; DROP TABLE t; still prompts, and unparseable options (ANALYZE 'false', a quoted option name, a missing )) keep the confirmation.

On local Postgres 17.11, the AI-1424 probe leaves the table untouched, while the same DELETE outside the literal, or under EXPLAIN ANALYZE, deletes the rows. Unit tests (805) and typecheck pass.

Refs AI-1431

@Rodriguespn
Rodriguespn marked this pull request as ready for review November 5, 2026 12:07
@Rodriguespn
Rodriguespn requested a review from a team as a code owner November 5, 2026 12:07
@coveralls

coveralls commented Nov 5, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 42027233782

Coverage increased (+0.1%) to 97.804%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: 70 of 70 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 5988
Covered Lines: 5886
Line Coverage: 98.3%
Relevant Branches: 1207
Covered Branches: 1151
Branch Coverage: 95.36%
Branches in Coverage %: Yes
Coverage Strength: 259.15 hits per line

💛 - Coveralls

Rodriguespn and others added 2 commits November 5, 2026 12:18
EXPLAIN without ANALYZE only plans its statement, so destructive keywords in its literals or wrapped statement no longer elicit. EXPLAIN ANALYZE now classifies the statement it runs, so EXPLAIN ANALYZE DELETE elicits. Unparseable EXPLAIN options keep the confirmation.

Refs AI-1431

Co-Authored-By: Claude <[email protected]>
@Rodriguespn
Rodriguespn force-pushed the Rodriguespn/ai-1431-explain-no-elicit branch from 54db611 to 1fd45f7 Compare November 5, 2026 12:27
@Rodriguespn
Rodriguespn merged commit 95745e5 into main Nov 5, 2026
5 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Nov 5, 2026
barryroodt pushed a commit that referenced this pull request Nov 5, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>mcp-server-supabase: 0.16.0</summary>

##
[0.16.0](mcp-server-supabase-v0.15.0...mcp-server-supabase-v0.16.0)
(2026-11-05)


### Features

* bound run_notebook cost
([#511](#511))
([e90d110](e90d110))
* **mcp-server-supabase:** run selected notebook cells
([#514](#514))
([8d04248](8d04248))
* **notebooks:** add delete_notebook tool with elicitation confirmation
([#510](#510))
([f36f74a](f36f74a))
* **notebooks:** enable create_notebook and run_notebook tools
([#509](#509))
([addc4e5](addc4e5))


### Bug Fixes

* **feedback:** accept null project_id and surface the feedback length
limit ([#521](#521))
([994f56c](994f56c))
* hint agents to re-copy malformed project refs
([#522](#522))
([0c650bf](0c650bf))
* **notebooks:** return caller errors for client-caused notebook
refusals ([#512](#512))
([5f0d393](5f0d393))
* **pg-meta:** report partition FKs once and add partition_of to
list_tables ([#508](#508))
([2c7fa82](2c7fa82))
* **pg-meta:** return complete check expressions for NOT VALID and NO
INHERIT constraints ([#517](#517))
([c54bb40](c54bb40))
* **sql:** skip destructive confirmation for planner-only EXPLAIN
([#519](#519))
([95745e5](95745e5))
* tolerate non-URL edge function paths in api platform
([#438](#438))
([00d07a4](00d07a4))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
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.

3 participants