Skip to content

fix(mcp): don't split an UPDATE on a semicolon inside a dollar-quoted value - #482

Merged
barryroodt merged 1 commit into
mainfrom
barryroodt/ai-1283-dollar-quoted-update-values
Oct 23, 2026
Merged

barryroodt merged 1 commit into
mainfrom
barryroodt/ai-1283-dollar-quoted-update-values

Conversation

@barryroodt

@barryroodt barryroodt commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix, follow-up to #459. Refs #457 and AI-1283.

What is the current behavior?

#459 stopped splitting an UPDATE on a ; inside a '...' value, but a dollar-quoted value still splits. So a normal update like this one asks for a destructive-SQL confirmation:

update t set note = $t$keep it; no exit$t$ where id = 1;

The first piece (update t set note = $t$keep it) has no WHERE, so isUpdateWithoutWhere returns true. We've seen this from a customer who writes long text values in dollar quotes. Every one of their cancelled UPDATEs had a ; inside the text.

What is the new behavior?

When a dollar quote opens inside an UPDATE, splitStatements treats it as a value. It blanks the quote the same way as a '...' span and doesn't split on its semicolons. Dollar quotes anywhere else (DO blocks, function bodies) still split like before, so the statements inside them are still checked. An unterminated dollar quote in an UPDATE falls back to the plain split, so it still flags.

What was updated?

  1. Splitter

    • Added a new branch in splitStatements where a dollar tag opens. Check that it only applies when the current statement starts with update.
  2. Tests

    • Added four new "does not split" rows ($$ and $tag$ values, a $$ inside a $t$ value, two UPDATEs in one call).
    • Added four new "still matches" rows (where inside a dollar value, an UPDATE inside a function body, an unterminated dollar quote, a dollar value followed by a real second statement).

… value

#459 stopped splitting an UPDATE on a semicolon inside a single-quoted value.
A dollar-quoted value ($t$a; b$t$) still split, so the first piece looked
like an UPDATE without WHERE and execute_sql asked for confirmation.

A dollar quote that opens inside an UPDATE is now blanked like a quoted span.
DO and function bodies keep splitting so their statements are still checked.

Refs #457
@barryroodt
barryroodt requested a review from a team as a code owner October 23, 2026 09:10
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 39929898422

Coverage increased (+0.004%) to 97.564%

Details

  • Coverage increased (+0.004%) from the base build.
  • Patch coverage: 9 of 9 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: 5660
Covered Lines: 5553
Line Coverage: 98.11%
Relevant Branches: 1073
Covered Branches: 1016
Branch Coverage: 94.69%
Branches in Coverage %: Yes
Coverage Strength: 149.28 hits per line

💛 - Coveralls

@barryroodt barryroodt self-assigned this Oct 23, 2026
@barryroodt
barryroodt merged commit 9f07410 into main Oct 23, 2026
5 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Oct 23, 2026
Rodriguespn pushed a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


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

##
[0.15.0](mcp-server-supabase-v0.14.0...mcp-server-supabase-v0.15.0)
(2026-10-29)


### Features

* `submit_feedback` and `delete_feedback` tools
([#474](#474))
([f50318a](f50318a))
* mark client-caused tool errors as ToolCallerError
([#480](#480))
([4a619c1](4a619c1))
* **mcp-server-supabase:** detect instant elicitation cancels
([#483](#483))
([5ad1a2a](5ad1a2a))


### Bug Fixes

* **mcp-server-supabase:** return a tool error when a confirmation
expires ([#490](#490))
([5ab9a98](5ab9a98))
* **mcp-server-supabase:** use POSIX path resolution for edge function
filenames ([#393](#393))
([55d2d24](55d2d24))
* **mcp:** don't split an UPDATE on a semicolon inside a dollar-quoted
value ([#482](#482))
([9f07410](9f07410))
* **mcp:** don't split an UPDATE on a semicolon inside a quoted value
([#459](#459))
([6d93b50](6d93b50))
* **pg-meta:** order list_tables columns by ordinal position
([c242e63](c242e63))
* **pg-meta:** order primary key columns by key position and exclude
INCLUDE columns ([#382](#382))
([25d357c](25d357c))
</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