SQL statement splitter breaks E'...' strings that contain a backslash-escaped quote
Maintainers usually reply within 1 day
@7ttp is already working on this.
Since Sep 29, 2026.
Assessment
This issue has not been assessed yet.
Description
Affected area: Migrations
Supabase CLI version: current develop (d38ccd7e)
Operating system: Any. Reproduced with a unit test on Linux.
Installation method: Built from source
Command
supabase db push
Actual output
A migration containing this statement fails with a syntax error:
select E'it\'s; here';
The CLI splits the statement at the semicolon inside the string literal and sends select E'it\'s and here' as two statements.
Expected behavior
The statement is sent as one statement. In an escape string constant, \' is an escaped quote and does not end the literal.
Steps to reproduce
- Add a migration that contains
select E'it\'s; here';. - Run
supabase db pushagainst a database. - See the syntax error caused by the split statement.
Additional context
The splitter in apps/cli/src/command-internal/sql-split.ts only treats a doubled quote as an escape inside single-quoted strings. PostgreSQL also accepts backslash escapes in E'...' strings, so the first \' is read as the end of the literal. A unit test for splitAndTrim fails on develop and passes when backslash escapes are honored for escape string constants only. Standard strings such as 'a\' are unchanged. The same splitter is used by seed files and the declarative schema commands.
I have a fix with a unit test ready and can open a PR if this is open for contribution.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 526
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 307
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/cli
-
🐛 Bug supabase/cli
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
🐛 Bug supabase/cli
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
db push applies migrations when the confirmation answer is not yes or noPossibly taken @7ttp claimed this 1 day ago. Open🐛 Bug supabase/cli
supabase/cli#6869 · 1 assignee ·
Maintainers usually reply within 1 day
-
🐛 Bug supabase/cli
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
🐛 Bug supabase/cli
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
Mend: dependency security vulnerability untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
opensearch-project/security-dashboards-plugin#2545 ·
Maintainers usually reply within 1 day
-
Add: Dream TR SDOpencheck:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
doctor integrity sample scans soft-deleted pages on Postgres (batch path has no deleted_at filter)Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
SocialGouv/egapro#4672 · 1 comment ·
Maintainers usually reply within 2 days
-
area:agents area:tui bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
anthropics/claude-code#98358 ·
Maintainers usually reply within 1 day