Repository navigation
fix(editor): read DELIMITER lines, COPY rows and IF ... ELSE as their clients do - #4210
Merged
Merged
Conversation
… their clients do; join conditions from foreign keys
datlechin
enabled auto-merge (squash)
November 11, 2026 19:58
…hole, and add the new strings
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
IF c S1; ELSE S2;stays one statement for Run Current, the gutter, folding and SQL import. The statement tracker can hold a;until the next token:ELSEtakes it back, anything else ends the statement there. The fail-closed gate from fix(macos): keep T-SQL blocks and rewinds whole, stop CSV sanitizing by default, and fix Stop, defaults and gate cancels across drivers #4185 is unchanged.DELIMITERlines as themysqlclient does. The line runs nothing, and the delimiter ends a statement anywhere in code. A;still ends a statement where the server splits, so a custom delimiter never hides a second statement from Safe Mode or MCP. Scanner, folding, import and formatter share oneSQLDelimiterDirectivereader.COPY ... FROM STDIN;up to the\.line belongs to theCOPYand is never SQL. The editor sends the header alone, so the driver's copy-in refusal stands and no row runs. SQL import stops at thatCOPYbefore sending it, naming its line, psql and--inserts. The formatter keeps aCOPYand its rows as written.\restrictand\unrestrictlines run nothing, so a current plain dump no longer fails on its first line. The import now reads PostgreSQL with the statement tracker, so aBEGIN ATOMICbody and a rule's action list arrive whole, as in the editor.COPYrows or delimiter, with the delimiter in force. Before, it readCOPYrows as statements.ON, foreign keys between the joined table and the earlier ones come first as whole conditions (o.customer_id = c.id). TheONlist no longer shows a qualified column twice, and iOS keeps the column's quotes after the qualifier.SQLStatementScan, one method per kind of token. New curated-only grammar factpsqlScripts(bit 41), no PluginKit change.SQLLexicalFeatureMappingTestspins the bit set, so it is updated here.Needs the maintainer
COPY ... FROM STDINrows (copy-in) is not in this PR. It needs a PluginKit copy-in call on the driver and an import element that streams the rows.Test plan
TSQLControlFlowBlockTests,SQLDelimiterDirectiveTests,SQLPsqlScriptTests,SQLStatementCursorIndexTests(new fixtures and edits),QueryScriptTests.replanAfterACopy,SQLJoinConditionCompletionTests,SQLContextAnalyzerJoinScopeTests.SQLFileParserTests,SQLFoldScannerTests,SQLTokenizerTests,SQLFormatterServiceTests,QueryClassifierClientScriptTests,MultiStatementReplanTests,SQLSchemaProviderTests.QueryCompletionCatalogTests,QueryCompletionControllerTests.