feat(#249): T-SQL / SQL Server syntax support (Phase 3)#317
feat(#249): T-SQL / SQL Server syntax support (Phase 3)#317ajitpratap0 merged 10 commits intomainfrom
Conversation
- Add TopClause AST node with Count and IsPercent fields - Parse SELECT TOP n and SELECT TOP n PERCENT in SQL Server dialect - Tokenize [identifier] as quoted identifiers in SQL Server dialect - Wire TopClause into SelectStatement
- Recognize OUTER as join keyword in SQL Server dialect - Parse CROSS APPLY and OUTER APPLY as lateral join equivalents - APPLY joins skip JOIN keyword and ON clause requirements - Add isNonReservedKeyword to expression parsing for TARGET/SOURCE
…identifiers - Parse OUTPUT clause in INSERT and MERGE statements (SQL Server) - Add INSERTED.*/DELETED.* column reference support - Handle unary minus in expressions (e.g., DATEADD(MONTH, -6, GETDATE())) - Allow non-reserved keywords as identifiers in expressions
- Add unit tests for TOP, TOP PERCENT, CROSS APPLY, OUTER APPLY - Add tests for square bracket identifiers, OFFSET/FETCH, MERGE, OUTPUT - Add negative number in function test (DATEADD with -6) - Validate 18/20 testdata/mssql/ files parse successfully - PIVOT/UNPIVOT and OPTION(MAXRECURSION) not yet supported
|
Claude finished @ajitpratap0's task —— View job PR Review: T-SQL / SQL Server Syntax Support (Phase 3)I've analyzed the implementation and test coverage for this PR. Here's my comprehensive review: Review Checklist
✅ StrengthsSolid Implementation:
Comprehensive Test Coverage:
|
🔴 CI Failed: Lint
Fix: Run Blocking merge until CI is green. |
…e error - Resolved merge conflicts in ast.go, dml.go, expressions.go - Merged OnDuplicateKey (MySQL) and Output (SQL Server) fields in InsertStatement - Fixed silent error discard in OUTPUT clause parsing - Fixed gofmt formatting in tsql_test.go - Preserved MySQL IF/REPLACE function parsing from main - Preserved isNonReservedKeyword() for T-SQL identifier handling
|
Claude finished @ajitpratap0's task —— View job PR Review: T-SQL / SQL Server Syntax Support (Phase 3)I've completed a comprehensive review of the T-SQL implementation. Here's my detailed analysis: ✅ StrengthsSolid Implementation Architecture
Excellent Test Coverage
|
…ope isNonReservedKeyword - TopClause.Count changed from int64 to ast.Expression for TOP (@var), TOP (n) - Support both TOP 10 and TOP (10) parenthesized syntax - Use existing ast.UnaryExpression with ast.Minus/Plus instead of 0-expr hack - Scope isNonReservedKeyword() to SQL Server dialect only (cross-dialect safety) - Add tests: TOP with parens, UnaryExpression verification, TARGET as column name - All existing tests pass
|
Claude finished @ajitpratap0's task —— View job PR Review: T-SQL / SQL Server Syntax Support (Phase 3)I've completed a comprehensive review of this T-SQL implementation focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist
✅ StrengthsExcellent Implementation Architecture
Outstanding Test Coverage
Architecture Compliance
|
Override minimatch to v10.2.1 to fix high-severity ReDoS vulnerability (GHSA-3ppc-4f35-3m26) causing Trivy repo scan failures in CI.
|
Claude finished @ajitpratap0's task —— View job PR Review: T-SQL / SQL Server Syntax Support (Phase 3)I've completed a comprehensive review of this T-SQL implementation. Here's my detailed analysis: ✅ StrengthsExcellent Implementation Architecture
Outstanding Test Coverage
Architecture Compliance
|
minimatch v10.2.1 uses the BlueOak-1.0.0 permissive license (equivalent to MIT in terms of permissions). Required after upgrading minimatch to fix CVE-2026-26996.
|
Claude finished @ajitpratap0's task —— View job PR Review: T-SQL / SQL Server Syntax Support (Phase 3)I've completed a comprehensive review of this T-SQL implementation. Here's my detailed analysis: ✅ StrengthsExcellent Implementation Architecture
Outstanding Test Coverage
Architecture Compliance
|
…obals, N-strings, bracket errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…QLSERVER_SPECIFIC keywords Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @ajitpratap0's task —— View job PR Review: T-SQL / SQL Server Syntax Support (Phase 3)I've completed a comprehensive review of this T-SQL implementation. Here's my detailed analysis: ✅ StrengthsExcellent Implementation Architecture
Outstanding Test Coverage
Architecture Compliance
|
T-SQL / SQL Server Dialect Support (Phase 3)
Closes #249
What's New
SELECT TOP N [PERCENT] — SQL Server's row-limiting syntax
SELECT TOP 10 id, name FROM usersSELECT TOP 50 PERCENT id, name FROM employeesSquare Bracket Identifiers —
[table].[column]quoting[dbo].[users]as quoted identifiers in SQL Server dialectCROSS APPLY / OUTER APPLY — Lateral join equivalents
FROM users u CROSS APPLY (SELECT TOP 3 ...) AS oFROM users u OUTER APPLY (SELECT COUNT(*) ...) AS oOUTPUT Clause — In INSERT and MERGE statements
INSERT INTO users (...) OUTPUT INSERTED.id, INSERTED.name VALUES (...)Unary Minus — Negative numbers in expressions
DATEADD(MONTH, -6, GETDATE())Non-reserved Keywords as Identifiers — TARGET, SOURCE, etc.
Test Coverage
Build on