Repository navigation
Conversation
… open no body at a begin name
datlechin
enabled auto-merge (squash)
November 12, 2026 22:28
# Conflicts: # apple/Packages/TableProCore/Sources/TableProSQLGrammar/SQLLexicalGrammar.swift # apple/Packages/TableProCore/Sources/TableProSQLGrammar/SQLLexicalReadings.swift # apple/TableProTests/Plugins/SQLLexicalFeatureMappingTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SETstatement no longer opens a block at abegincolumn and swallows the rest of the script. ASETin the return type (RETURNS SET(...),CHARACTER SET,CHAR SET) stays header.IF ... END IF,WHILE ... END WHILE,LOOP ... END LOOPorREPEAT ... END REPEATbody holds its own;s, so Run All, SQL import and the gates read the routine as one statement, and abegincolumn inside it is a name.IFandWHILEopen their block only at theTHEN,DOor Oracle-modeLOOPthat ends the condition, soIF()andREPEAT()stay functions. An event's schedule, beforeDO, starts no body.compoundStatementBodies, set on the MySQL grammar only. Engines TablePro does not know read no compound body.BEGIN ... ENDbodies: theTHENandELSEof aCASEexpression, and aCASEinside a handler's statement, start no statement, soCASE WHEN closed THEN begin ELSE NULL ENDno longer opens a block.BEGIN ATOMICbody only a nestedCREATE FUNCTIONorCREATE PROCEDUREopens a body, soSELECT begin atomic FROM tis a column and its alias. Before,CREATE FUNCTION f() ... BEGIN ATOMIC SELECT begin atomic FROM t; END; DROP TABLE users; ENDread as one write, so Safe Mode and the MCP gate missed theDROP. PostgreSQL 17.11 runs it when the text arrives in one simple query, as Linux and Windows send it.BEGIN ATOMICopens a routine body, soCREATE FUNCTION begin() ...; DROP TABLE usersis two statements and Safe Mode sees theDROP. Before, the gate tiered it a write and PostgreSQL ran both in one simple query.E'a'and a'...'on the next line ends the string, as PostgreSQL'squotecontinuereads it. Remove Invisible Characters now cleans it, so the result runs. Only DuckDB 1.5's reading, which blanks the space before lexing, still joins the two. The core's lexer already read it this way; a test pins it.Test plan
SQLRoutineBodyNameTests(setBodiesOnMySQL,compoundBodiesOnMySQL,mySQLGatesSeeTheStatementAfterTheBody,beginAtomicAliasHidesNothing, newatomicBodiesandnamesOnOtherEnginescases),SQLNonCodeSpanTests.nonASCIISpaceBeforeAContinuedStringand...HidesNothing,QueryClassifierLexicalTests.statementAfterABodyIsItsOwn,InvisibleCharacterRemoverTests.nonASCIISpaceBeforeAContinuedString, corea_begin_name_in_a_routine_opens_no_bodyanda_begin_before_anything_but_atomic_is_a_name.oracleModeWhileLoop(MariaDB Oracle mode),unknownEnginesKeepTSQLControlFlow(no reading of an unknown engine holds aWHILE,LOOPor T-SQLIFopen), newendsInsideOpenBlockcases (anIFbody left open is refused as several statements).SQLNonCodeSpanTests.escapeStringContinuesAfterALineBreakpinned the NBSP join on PostgreSQL; that case moved to the new test, both ways.SQLLexicalFeatureMappingTestscounts 45 bits, and its MySQL round trip leaves out the new curated-only fact.SELECT E'a'<NBSP>\n'b'is a syntax error and psql ran the statement after'\'; eachbegin-named definition, and thebegin atomicone, ran with theDROPafter it. DuckDB 1.5.4 joins the NBSP text intoab.tablepro-coretests, clippy, rustfmt, SwiftLint.