GoSQLX SQL Feature Compatibility Matrix

Version: v1.10.0 | Last Updated: 2026-03-13

Overview

This matrix documents the comprehensive SQL feature support in GoSQLX across different SQL dialects and standards. The testing was conducted using the comprehensive integration test suite with 700+ test cases covering real-world SQL patterns.

Recent Additions (v1.9.0)

  • SQLite PRAGMA: Fully parsed — bare (PRAGMA x), arg (PRAGMA x(n)), and assignment (PRAGMA x=v) forms; PragmaStatement AST node
  • WITHOUT ROWID: CREATE TABLE ... WITHOUT ROWID; reserved keywords now valid as DDL column names
  • Tautology Detection: ScanSQL() detects 1=1, 'a'='a', col=col, OR TRUE → CRITICAL severity (PatternTautology)
  • UNION Detection Split: PatternUnionInjection (CRITICAL, system tables + NULL padding) / PatternUnionGeneric (HIGH) — eliminates false-positive CRITICAL on legitimate queries
  • E1009: ErrCodeUnterminatedBlockComment for unterminated /* ... */ block comments
  • Dialect Fixes: MySQL backtick + SQL Server bracket reserved-word identifiers now parsed correctly
  • Parser Fixes: KEY/INDEX in qualified names, NATURAL JOIN type, OVER window_name (bare name per SQL:2003 §7.11)

Previous Additions (v1.8.0)

  • Dialect Mode Engine: First-class dialect support with ParseWithDialect() — thread dialect through tokenizer and parser
  • MySQL Syntax Support:
    • LIMIT offset, count - MySQL-style LIMIT 10, 20
    • ON DUPLICATE KEY UPDATE - MySQL upsert syntax
    • SHOW statements - SHOW TABLES, SHOW DATABASES, SHOW CREATE TABLE
    • DESCRIBE/EXPLAIN - Table description commands
    • REPLACE INTO - MySQL insert-or-replace
    • UPDATE/DELETE with LIMIT - MySQL extension
    • GROUP_CONCAT - With ORDER BY and SEPARATOR clause
    • MATCH AGAINST - Full-text search expressions
    • REGEXP/RLIKE - Regular expression operators
    • INTERVAL number unit - MySQL-style INTERVAL 30 DAY
  • Query Transform API: Programmatic SQL rewriting via pkg/transform/
  • Comment Preservation: Comments survive parse-format round-trips
  • AST-to-SQL Serialization: SQL() methods on all AST nodes
  • Dollar-Quoted Strings: PostgreSQL $$body$$ and $tag$body$tag$
  • Error Recovery: Multi-error parsing with ParseWithRecovery()
  • ~50% Faster Parsing: Token type overhaul with O(1) integer comparison
  • Snowflake Dialect: Keyword detection and weighted dialect scoring

Previous Additions (v1.7.0)

  • Schema-Qualified Names: Full support for schema.table, db.schema.table in all DML/DDL statements
  • PostgreSQL Enhancements:
    • Type Casting - :: operator for PostgreSQL-style casts (SELECT 1::int)
    • UPSERT - INSERT ... ON CONFLICT DO UPDATE/NOTHING
    • Positional Parameters - $1, $2 style parameter placeholders
    • JSONB Operators - Additional @? and @@ operators
    • Regex Operators - ~, ~*, !~, !~* for pattern matching
  • ARRAY Constructors: ARRAY[1, 2, 3] expressions with subscript/slice operations
  • WITHIN GROUP - Ordered-set aggregate functions
  • INTERVAL Expressions - INTERVAL '1 day' temporal literals
  • FOR UPDATE/SHARE - Row-level locking clauses
  • Multi-row INSERT - INSERT INTO t VALUES (1), (2), (3) batch inserts

Previous Additions (v1.6.0)

  • PostgreSQL Extensions:
    • LATERAL JOIN - Correlated subqueries in FROM clause
    • JSON/JSONB Operators - Complete operator set (->, ->>, #>, #>>, @>, <@, ?, ?|, ?&, #-)
    • DISTINCT ON - PostgreSQL-specific row selection
    • FILTER Clause - Conditional aggregation (SQL:2003)
    • Aggregate ORDER BY - Ordering within aggregate functions
    • RETURNING Clause - Return modified rows from INSERT/UPDATE/DELETE
  • SQL Standards:
    • FETCH FIRST n ROWS - Standard row limiting (SQL-99 F861)
    • FETCH WITH TIES - Include tied rows (SQL-99 F862)
    • OFFSET-FETCH - Standard pagination
    • TRUNCATE TABLE - SQL:2008 table truncation
    • Materialized CTE Hints - CTE optimization

Previous Additions (v1.4+)

  • MERGE Statements (SQL:2003 F312)
  • GROUPING SETS, ROLLUP, CUBE (SQL-99 T431)
  • Materialized Views (CREATE, DROP, REFRESH)
  • Table Partitioning (RANGE, LIST, HASH)
  • NULLS FIRST/LAST (SQL-99 F851)
  • Advanced Operators (BETWEEN, IN, LIKE, IS NULL)
  • Comprehensive Subqueries (Scalar, Table, Correlated, EXISTS)
  • Window Functions - Complete SQL-99 support (ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, etc.)
  • SQL Injection Detection (pkg/sql/security package)

Legend

  • Full Support: Complete parsing and AST generation with validation
  • ⚠️ Partial Support: Basic syntax recognition, limited semantic validation
  • Not Supported: Feature not recognized or causes parsing errors
  • 🔧 Syntax Only: Recognizes syntax but no semantic validation

Core SQL Features Support Matrix

Data Manipulation Language (DML)

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
SELECT✅ Full100%
Basic WHERE clauses✅ Full100%
Complex WHERE (nested)✅ Full100%
ORDER BY✅ Full100%
GROUP BY✅ Full100%
HAVING✅ Full100%
DISTINCT✅ Full100%
LIMIT/TOP✅ Full95%
FETCH FIRST (SQL-99 F861)✅ Full95%
FETCH WITH TIES (SQL-99 F862)✅ Full90%
OFFSET-FETCH pagination✅ Full95%
INSERT✅ Full100%
INSERT VALUES✅ Full100%
INSERT SELECT✅ Full100%
Multi-row INSERT✅ Full100%
UPDATE✅ Full100%
UPDATE with JOIN✅ Full90%
Multi-table UPDATE✅ Full80%
DELETE✅ Full100%
DELETE with JOIN✅ Full90%
TRUNCATE✅ Full95%
TRUNCATE with CASCADE✅ Full90%
MERGE (SQL:2003 F312)✅ Full95%
MERGE WHEN MATCHED✅ Full95%
MERGE WHEN NOT MATCHED✅ Full95%
RETURNING Clause (PostgreSQL)✅ Full95%
INSERT…RETURNING✅ Full95%
UPDATE…RETURNING✅ Full95%
DELETE…RETURNING✅ Full95%

Data Definition Language (DDL)

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
CREATE TABLE✅ Full100%
Column definitions✅ Full100%
Primary keys✅ Full100%
Foreign keys✅ Full100%
Unique constraints✅ Full100%
Check constraints✅ Full95%
ALTER TABLE✅ Full95%
ADD COLUMN✅ Full100%
DROP COLUMN✅ Full100%
MODIFY COLUMN✅ Full95%
DROP TABLE✅ Full100%
CREATE INDEX✅ Full100%
Unique indexes✅ Full100%
Partial indexes⚠️⚠️ Partial40%
CREATE VIEW✅ Full100%
CREATE MATERIALIZED VIEW✅ Full95%
REFRESH MATERIALIZED VIEW✅ Full95%
TABLE PARTITIONING✅ Full90%
PARTITION BY RANGE✅ Full90%
PARTITION BY LIST✅ Full90%
PARTITION BY HASH✅ Full90%

JOIN Operations

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
INNER JOIN✅ Full100%
LEFT JOIN✅ Full100%
RIGHT JOIN✅ Full100%
FULL OUTER JOIN✅ Full85%
CROSS JOIN✅ Full100%
NATURAL JOIN✅ Full95%
Multiple table JOINs✅ Full100%
Self JOINs✅ Full100%
LATERAL JOIN (PostgreSQL)✅ Full95%
LATERAL with LEFT JOIN✅ Full95%
LATERAL with INNER JOIN✅ Full95%
LATERAL with CROSS JOIN✅ Full95%
JOIN with USING clause✅ Full95%

Subqueries

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
Scalar subqueries✅ Full100%
Table subqueries✅ Full100%
Correlated subqueries✅ Full100%
EXISTS✅ Full100%
NOT EXISTS✅ Full100%
IN (subquery)✅ Full100%
ANY/SOME✅ Full95%
ALL✅ Full95%

Aggregate Functions

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
COUNT✅ Full100%
SUM✅ Full100%
AVG✅ Full100%
MIN/MAX✅ Full100%
FILTER Clause (SQL:2003)✅ Full95%
COUNT(*) FILTER (WHERE…)✅ Full95%
Aggregate ORDER BY (PostgreSQL)✅ Full95%
GROUP_CONCAT✅ Full95%
STRING_AGG✅ Full90%
ARRAY_AGG✅ Full90%

Advanced SQL Features

Common Table Expressions (CTEs)

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
Basic CTE (WITH clause)✅ Full100%
Multiple CTEs✅ Full100%
Recursive CTE✅ Full100%
Nested CTEs✅ Full95%
Materialized CTE Hints✅ Full90%
WITH…AS MATERIALIZED✅ Full90%
WITH…AS NOT MATERIALIZED✅ Full90%

Window Functions

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
ROW_NUMBER()✅ Full100%
RANK()✅ Full100%
DENSE_RANK()✅ Full100%
NTILE()✅ Full100%
LAG/LEAD✅ Full100%
FIRST_VALUE/LAST_VALUE✅ Full100%
NTH_VALUE✅ Full95%
PARTITION BY✅ Full100%
ORDER BY in window✅ Full100%
ROWS frame✅ Full95%
RANGE frame✅ Full90%
Frame UNBOUNDED PRECEDING✅ Full95%
Frame UNBOUNDED FOLLOWING✅ Full95%
Frame CURRENT ROW✅ Full95%
Frame N PRECEDING/FOLLOWING✅ Full90%

Set Operations

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
UNION✅ Full100%
UNION ALL✅ Full100%
INTERSECT✅ Full90%
EXCEPT/MINUS✅ Full90%

Grouping Operations (SQL-99 T431)

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
GROUPING SETS✅ Full95%
ROLLUP✅ Full95%
CUBE✅ Full95%
Combined GROUPING SETS✅ Full90%
GROUPING() function✅ Full90%

ORDER BY Extensions (SQL-99 F851)

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
NULLS FIRST✅ Full95%
NULLS LAST✅ Full95%
Multiple columns with NULLS✅ Full90%

Expression Operators

FeaturePostgreSQLMySQLSQL ServerOracleSQLiteGoSQLX ParserTest Coverage
BETWEEN…AND✅ Full100%
NOT BETWEEN✅ Full100%
IN (list)✅ Full100%
IN (subquery)✅ Full100%
NOT IN✅ Full100%
LIKE✅ Full100%
NOT LIKE✅ Full100%
IS NULL✅ Full100%
IS NOT NULL✅ Full100%
IS TRUE/FALSE✅ Full90%

Dialect-Specific Features

Note: This section documents dialect-specific features where “Support Level” refers to the native database’s support, while “GoSQLX Parser” and “Test Coverage” indicate GoSQLX implementation status. Many features listed have keyword recognition only (🔧 Syntax) without full parsing logic.

PostgreSQL-Specific Features

FeatureSupport LevelGoSQLX ParserTest CoverageNotes
Arrays✅ Full🔧 Syntax40%Keyword recognition only
JSON/JSONB Types✅ Full✅ Full95%Full type support
JSON -> Operator✅ Full✅ Full95%Extract JSON field as JSON
JSON ->> Operator✅ Full✅ Full95%Extract JSON field as text
JSON #> Operator✅ Full✅ Full95%Extract nested JSON path as JSON
JSON #>> Operator✅ Full✅ Full95%Extract nested JSON path as text
JSON @> Operator✅ Full✅ Full95%Contains (left contains right)
JSON <@ Operator✅ Full✅ Full95%Contained by (left contained by right)
JSON ? Operator✅ Full✅ Full95%Key exists
**JSON ?Operator**✅ Full✅ Full95%
JSON ?& Operator✅ Full✅ Full95%All keys exist
JSON #- Operator✅ Full✅ Full95%Delete path
DISTINCT ON✅ Full✅ Full95%SELECT DISTINCT ON (columns) ORDER BY…
FILTER Clause✅ Full✅ Full95%Aggregate FILTER (WHERE condition)
Aggregate ORDER BY✅ Full✅ Full95%string_agg(col, ’,’ ORDER BY col)
RETURNING Clause✅ Full✅ Full95%INSERT/UPDATE/DELETE RETURNING
Full-text search✅ Full🔧 Syntax30%tsvector, tsquery types
LATERAL Joins✅ Full✅ Full95%Full support with LEFT/INNER/CROSS variants
Custom operators✅ Full⚠️ Partial30%Basic operator recognition
Dollar quoting✅ Full✅ Full90%$$body$$ and $tag$body$tag$ (v1.8.0)

MySQL-Specific Features (Enhanced in v1.8.0)

FeatureSupport LevelGoSQLX ParserTest CoverageNotes
SHOW statements✅ Full✅ Full95%SHOW TABLES, DATABASES, CREATE TABLE (v1.8.0)
DESCRIBE/EXPLAIN✅ Full✅ Full95%Table description commands (v1.8.0)
REPLACE INTO✅ Full✅ Full95%MySQL insert-or-replace (v1.8.0)
ON DUPLICATE KEY UPDATE✅ Full✅ Full95%MySQL upsert syntax (v1.8.0)
LIMIT offset, count✅ Full✅ Full95%MySQL-style LIMIT 10, 20 (v1.8.0)
UPDATE/DELETE with LIMIT✅ Full✅ Full90%MySQL extension (v1.8.0)
GROUP_CONCAT✅ Full✅ Full95%With ORDER BY and SEPARATOR (v1.8.0)
MATCH/AGAINST✅ Full✅ Full95%Full-text search (v1.8.0)
REGEXP/RLIKE✅ Full✅ Full90%Regular expression operators (v1.8.0)
INTERVAL number unit✅ Full✅ Full90%MySQL-style INTERVAL 30 DAY (v1.8.0)
IF()/REPLACE() as functions✅ Full✅ Full85%Keywords usable as function names (v1.8.0)
Storage engines✅ Full🔧 Syntax80%ENGINE=InnoDB syntax
Index hints✅ Full✅ Full75%USE/IGNORE/FORCE INDEX
Partitioning✅ Full🔧 Syntax70%PARTITION BY syntax
AUTO_INCREMENT✅ Full✅ Full95%Column property
Backtick identifiers✅ Full✅ Full100%`table`.`column` syntax

SQL Server-Specific Features

FeatureSupport LevelGoSQLX ParserTest CoverageNotes
MERGE✅ Full✅ Full95%MERGE statements with WHEN clauses
PIVOT/UNPIVOT✅ Full🔧 Syntax10%Keywords reserved, no parsing logic
CROSS/OUTER APPLY✅ Full🔧 Syntax10%Keywords reserved, no parsing logic
HierarchyID✅ Full🔧 Syntax20%Data type recognition
T-SQL functions✅ Full⚠️ Partial40%Subset of T-SQL functions

Oracle-Specific Features

FeatureSupport LevelGoSQLX ParserTest CoverageNotes
CONNECT BY✅ Full🔧 Syntax10%Keywords reserved, no parsing logic
PRIOR operator✅ Full🔧 Syntax10%Keyword reserved, no parsing logic
DECODE function✅ Full⚠️ Partial40%Recognized as function, no special handling
NVL/NVL2✅ Full⚠️ Partial40%Recognized as function, no special handling
Dual table✅ Full✅ Full100%Standard table reference
Analytic functions✅ Full⚠️ Partial60%Subset via window functions

SQLite-Specific Features

FeatureSupport LevelGoSQLX ParserTest CoverageNotes
PRAGMA✅ Full✅ Full90%Bare, arg, and assignment forms fully parsed
ATTACH/DETACH✅ Full🔧 Syntax10%Keywords reserved, no parsing logic
Type affinity✅ Full⚠️ Partial30%Flexible typing
WITHOUT ROWID✅ Full✅ Full85%CREATE TABLE option fully supported
Simplified syntax✅ Full✅ Full85%SQLite variations

SQL Standards Compliance

SQL-92 (Entry Level)

Feature CategorySupport LevelTest CoverageNotes
Basic data types✅ Full100%CHAR, VARCHAR, INTEGER, etc.
Basic predicates✅ Full100%=, <>, <, >, <=, >=
Basic expressions✅ Full100%Arithmetic, string operations
Subqueries✅ Full100%WHERE and HAVING subqueries
Aggregate functions✅ Full100%COUNT, SUM, AVG, MIN, MAX
Joins✅ Full95%Inner and outer joins
UNION✅ Full100%Set operations

SQL-99 (Core Features)

Feature CategorySupport LevelTest CoverageNotes
Regular expressions⚠️ Partial60%SIMILAR TO operator
Array types⚠️ Partial40%Limited array support
Common Table Expressions✅ Full100%WITH clause
Window functions✅ Full95%OVER clause
CASE expressions✅ Full100%Simple and searched CASE
Recursive queries✅ Full100%Recursive CTEs

SQL-2003 (XML Features)

Feature CategorySupport LevelTest CoverageNotes
Window functions✅ Full100%Enhanced window support
MERGE statement✅ Full80%UPSERT operations
Object identifiers✅ Full90%Standardized identifiers
XML data type🔧 Syntax30%Basic syntax recognition
XML functions❌ Not Supported0%XMLQuery, XMLTable, etc.

SQL-2006 (Enhancement)

Feature CategorySupport LevelTest CoverageNotes
Enhanced window functions✅ Full95%Additional frame options
More built-in functions⚠️ Partial70%Subset of new functions
IMPORT/EXPORT❌ Not Applicable0%Not relevant for parser

SQL-2008 (Enhancements)

Feature CategorySupport LevelTest CoverageNotes
INSTEAD OF triggers🔧 Syntax50%Syntax recognition only
Enhanced MERGE✅ Full80%Extended MERGE capabilities
TRUNCATE statement✅ Full95%Full TRUNCATE support with CASCADE
FETCH FIRST/NEXT✅ Full95%Standard row limiting (F861/F862)

SQL-2011 (Temporal Data)

Feature CategorySupport LevelTest CoverageNotes
Temporal tables🔧 Syntax30%FOR SYSTEM_TIME syntax
Window function enhancements⚠️ Partial60%Some new functions

SQL-2016 (JSON Support)

Feature CategorySupport LevelTest CoverageNotes
JSON data type🔧 Syntax40%Type recognition
JSON functions⚠️ Partial20%Limited function support
Row pattern recognition❌ Not Supported0%MATCH_RECOGNIZE clause

v1.6.0 PostgreSQL Extension Summary

GoSQLX v1.6.0 introduces comprehensive PostgreSQL-specific feature support, making it one of the most PostgreSQL-compatible SQL parsers available.

Complete PostgreSQL Feature Set

Feature CategoryFeatures IncludedSupport LevelUse Cases
JSON/JSONBAll 10 operators (->, ->>, #>, #>>, @>, <@, ?, `?, ?&, #-`)✅ Full
LATERAL JoinsLEFT LATERAL, INNER LATERAL, CROSS LATERAL✅ FullCorrelated subqueries, row-level computations
DISTINCT ONSELECT DISTINCT ON with ORDER BY✅ FullDeduplication, first/last row selection
FILTER ClauseConditional aggregation on all aggregates✅ FullMulti-condition analytics in single query
Aggregate ORDER BYOrdering within aggregate functions✅ FullString concatenation, array aggregation
RETURNINGINSERT/UPDATE/DELETE RETURNING✅ FullAudit trails, single-trip operations

JSON/JSONB Operator Examples

-- Extract field as JSON (->)
SELECT data->'user' FROM events;

-- Extract field as text (->>)
SELECT data->>'email' FROM users;

-- Extract nested path as JSON (#>)
SELECT data#>'{user,address,city}' FROM profiles;

-- Extract nested path as text (#>>)
SELECT data#>>'{user,name}' FROM profiles;

-- Contains (@>)
SELECT * FROM products WHERE attributes @> '{"color": "red"}';

-- Contained by (<@)
SELECT * FROM users WHERE tags <@ '["admin", "user"]';

-- Key exists (?)
SELECT * FROM profiles WHERE data ? 'email';

-- Any key exists (?|)
SELECT * FROM users WHERE profile ?| array['phone', 'mobile'];

-- All keys exist (?&)
SELECT * FROM users WHERE profile ?& array['name', 'email'];

-- Delete path (#-)
SELECT data #- '{user,temp}' FROM cache;

LATERAL JOIN Examples

-- Correlated subquery in FROM clause
SELECT u.name, recent.order_date
FROM users u,
LATERAL (
    SELECT order_date FROM orders
    WHERE user_id = u.id
    ORDER BY order_date DESC
    LIMIT 3
) recent;

-- LEFT LATERAL JOIN
SELECT u.name, stats.total
FROM users u
LEFT JOIN LATERAL (
    SELECT SUM(amount) as total
    FROM transactions
    WHERE user_id = u.id
) stats ON true;

DISTINCT ON Examples

-- Get first row per department
SELECT DISTINCT ON (dept_id) dept_id, name, salary
FROM employees
ORDER BY dept_id, salary DESC;

-- Latest status per user
SELECT DISTINCT ON (user_id) user_id, status, updated_at
FROM user_status_log
ORDER BY user_id, updated_at DESC;

FILTER Clause Examples

-- Multi-condition aggregation
SELECT
    dept_id,
    COUNT(*) FILTER (WHERE status = 'active') AS active_count,
    COUNT(*) FILTER (WHERE status = 'inactive') AS inactive_count,
    SUM(salary) FILTER (WHERE bonus_eligible = true) AS bonus_pool
FROM employees
GROUP BY dept_id;

RETURNING Clause Examples

-- INSERT with RETURNING
INSERT INTO users (name, email)
VALUES ('John Doe', 'john@example.com')
RETURNING id, created_at;

-- UPDATE with RETURNING
UPDATE products
SET price = price * 1.1
WHERE category = 'Electronics'
RETURNING id, name, price;

-- DELETE with RETURNING
DELETE FROM sessions
WHERE expired_at < NOW()
RETURNING user_id, session_id;

Dialect Mode Engine (v1.8.0)

GoSQLX v1.8.0 introduces a first-class dialect mode engine that threads the SQL dialect through the tokenizer and parser. This enables dialect-specific keyword recognition, syntax parsing, and validation.

Supported Dialects

DialectDialect StringKeyword SetDialect-Specific ParsingStatus
PostgreSQL"postgresql"Full PG keywords::, ON CONFLICT, $$, JSONB ops, LATERAL, DISTINCT ON✅ Default dialect
MySQL"mysql"MySQL keywordsSHOW, DESCRIBE, REPLACE INTO, ON DUPLICATE KEY, LIMIT n,m, GROUP_CONCAT, MATCH AGAINST, REGEXP✅ Full support
SQL Server"sqlserver"T-SQL keywordsMERGE, bracket identifiers [col]⚠️ Keywords + basic parsing
Oracle"oracle"Oracle keywordsDUAL table, basic PL/SQL keywords⚠️ Keywords + basic parsing
SQLite"sqlite"SQLite keywordsFlexible typing, simplified syntax⚠️ Keywords + basic parsing
Snowflake"snowflake"Snowflake keywordsStage operations, VARIANT type⚠️ Keyword detection only

Usage

// API
ast, err := parser.ParseWithDialect("SHOW TABLES", "mysql")
err = parser.ValidateWithDialect("DESCRIBE users", "mysql")

// CLI
gosqlx validate --dialect mysql "SHOW TABLES"
gosqlx format --dialect mysql query.sql

Known Gaps by Dialect

PostgreSQL (default, best supported)

  • PL/pgSQL procedural blocks not parsed
  • Some advanced array operations limited
  • Full-text search tsvector/tsquery syntax-only recognition

MySQL

  • Stored procedures / functions not parsed
  • HANDLER statements not supported
  • XA transactions not supported
  • CREATE EVENT not supported

SQL Server (T-SQL)

  • PIVOT/UNPIVOT keywords reserved but no parsing logic
  • CROSS/OUTER APPLY keywords reserved but no parsing logic
  • TRY/CATCH blocks not supported
  • OPENROWSET / OPENQUERY not supported

Oracle

  • CONNECT BY / START WITH / PRIOR not parsed (keywords reserved)
  • PL/SQL blocks not supported
  • DECODE recognized as generic function only
  • Pipelined table functions not supported

SQLite

  • PRAGMA statements not parsed (keyword reserved)
  • ATTACH/DETACH not parsed (keywords reserved)
  • VACUUM not supported
  • Virtual tables (FTS5, rtree) not supported

Snowflake

  • Keyword detection and dialect scoring only
  • No Snowflake-specific parsing (stages, COPY INTO, VARIANT operations)
  • QUALIFY clause not supported

SQL Standards Compliance Summary

Overall Compliance (v1.10.0)

StandardCompliance %StatusNotes
SQL-92 Entry~95%✅ ExcellentAll core features supported
SQL-92 Intermediate~85%✅ StrongMost features supported
SQL-99 Core~85%✅ StrongWindow functions, CTEs, recursive queries
SQL:2003~75%✅ GoodMERGE, FILTER, enhanced window functions
SQL:2008~65%✅ GoodTRUNCATE, FETCH FIRST/NEXT
SQL:2011~40%⚠️ PartialSome temporal features, limited support
SQL:2016~50%⚠️ PartialJSON support via PostgreSQL extensions

Feature Category Compliance

CategoryFeatures SupportedTotal FeaturesCompliance %
Basic DML18/1818100%
Advanced DML12/151580%
DDL Operations22/252588%
JOIN Operations10/1010100%
Subqueries8/88100%
Aggregate Functions10/131377%
Window Functions15/161694%
CTEs7/77100%
Set Operations4/44100%
Expression Operators9/99100%
PostgreSQL Extensions20/252580%

Dialect-Specific Compliance

DatabaseCore FeaturesExtensionsOverall RatingNotes
PostgreSQL95%85%⭐⭐⭐⭐⭐ ExcellentDefault dialect, best supported
MySQL95%85%⭐⭐⭐⭐⭐ ExcellentFull dialect parsing (v1.8.0)
SQL Server85%65%⭐⭐⭐⭐ Very GoodKeywords + MERGE
Oracle80%60%⭐⭐⭐⭐ GoodKeywords + basic features
SQLite85%50%⭐⭐⭐⭐ GoodKeywords + basic features
Snowflake80%30%⭐⭐⭐ GoodKeyword detection only

Performance Characteristics by Feature

High Performance Features (>1M ops/sec)

  • Basic SELECT statements
  • Simple INSERT/UPDATE/DELETE
  • Basic WHERE clauses
  • Simple JOINs (2-3 tables)
  • Standard aggregate functions
  • Basic subqueries

Good Performance Features (100K-1M ops/sec)

  • Complex WHERE clauses
  • Multi-table JOINs (4-6 tables)
  • Window functions
  • Simple CTEs
  • Set operations (UNION, etc.)
  • Complex subqueries

Moderate Performance Features (10K-100K ops/sec)

  • Recursive CTEs
  • Very complex JOINs (7+ tables)
  • Deeply nested subqueries
  • Complex window functions with frames
  • Large CASE expressions

Lower Performance Features (<10K ops/sec)

  • Extremely complex queries (1000+ tokens)
  • Deeply nested expressions (10+ levels)
  • Very large DDL statements
  • Queries with 100+ columns

Edge Case Support

Unicode and International Support

FeatureSupport LevelTest Coverage
Unicode identifiers✅ Full95%
Unicode string literals✅ Full100%
Multi-byte characters✅ Full90%
Right-to-left text✅ Full80%
Emoji in comments✅ Full70%

Extreme Query Patterns

FeatureSupport LevelTest Coverage
Very long queries (50K+ chars)✅ Full80%
Deeply nested subqueries (10+ levels)✅ Full85%
Large column lists (100+ columns)✅ Full75%
Complex WHERE clauses (50+ conditions)✅ Full80%
Large IN lists (1000+ values)✅ Full70%

Error Recovery

ScenarioSupport LevelTest Coverage
Syntax errors with context✅ Full95%
Incomplete queries✅ Full90%
Invalid token sequences✅ Full85%
Unmatched parentheses✅ Full100%
Invalid string literals✅ Full95%

Production Readiness Summary

Ready for Production (v1.7.0)

Core DML/DDL:

  • Core SQL operations (SELECT, INSERT, UPDATE, DELETE, TRUNCATE)
  • Standard joins and subqueries (all types including LATERAL)
  • Window functions and CTEs (including recursive and materialized hints)
  • MERGE statements (SQL:2003 F312)
  • GROUPING SETS, ROLLUP, CUBE (SQL-99 T431)
  • Materialized views
  • Table partitioning

PostgreSQL Extensions (v1.6.0-v1.7.0):

  • JSON/JSONB operators - All 10 operators (->, ->>, #>, #>>, @>, <@, ?, ?|, ?&, #-)
  • LATERAL JOIN - Full support with LEFT/INNER/CROSS variants
  • DISTINCT ON - PostgreSQL-specific row selection
  • FILTER clause - Conditional aggregation
  • Aggregate ORDER BY - Ordering within aggregate functions
  • RETURNING clause - INSERT/UPDATE/DELETE RETURNING

Standards & Performance:

  • FETCH FIRST/NEXT - SQL-99 F861/F862 standard pagination
  • OFFSET-FETCH - Standard row limiting
  • Multi-dialect basic syntax
  • Unicode and international text
  • High-performance scenarios (1.25M ops/sec peak)

Suitable with Considerations

  • Advanced dialect-specific features (keyword recognition only for: PIVOT/UNPIVOT, CONNECT BY, PRAGMA, ATTACH/DETACH)
  • Complex XML operations (syntax recognition only)
  • Dialect-specific functions (DECODE, NVL, recognized as generic functions)
  • Newest SQL standard features (SQL-2011+)
  • Very large query processing

Development Needed

  • PIVOT/UNPIVOT parsing logic (keywords reserved)
  • CONNECT BY hierarchical queries (keywords reserved)
  • Full XML function support
  • Row pattern recognition (MATCH_RECOGNIZE)
  • Complete temporal table support
  • SQLite PRAGMA statements (keywords reserved)
  • Advanced array operations

Recommendations

For Web Applications

  • Excellent support for typical web app queries
  • High performance for user authentication, content management
  • Multi-dialect compatibility for different backends
  • PostgreSQL JSON/JSONB support for modern document storage
  • RETURNING clause for efficient single-trip operations

For Analytics Platforms

  • Strong support for complex analytical queries
  • Full CTE and window function support
  • GROUPING SETS, ROLLUP, CUBE for OLAP operations
  • FILTER clause for conditional aggregation
  • ⚠️ Consider dialect-specific features for advanced analytics

For PostgreSQL Applications

  • Industry-leading PostgreSQL support with 95% core feature coverage
  • Complete JSON/JSONB operator support (10 operators)
  • LATERAL JOIN for advanced correlated subqueries
  • DISTINCT ON for PostgreSQL-specific deduplication
  • Aggregate ORDER BY for string aggregation
  • Best-in-class PostgreSQL compatibility

For Database Tools

  • Comprehensive DDL support
  • Excellent error handling and recovery
  • Multi-dialect parsing capabilities
  • SQL injection detection built-in

For Migration Tools

  • Strong cross-dialect compatibility
  • Robust error handling
  • PostgreSQL extension awareness
  • ⚠️ Manual handling needed for dialect-specific features (PIVOT, CONNECT BY)

Last Updated: 2026-03-13 GoSQLX Version: 1.10.0 Test Suite Version: 1.10.0 Total Test Cases: 800+ Coverage Percentage: 95%+ SQL-99 Compliance: ~85% PostgreSQL Compliance: ~95% (core features), ~85% (extensions) MySQL Compliance: ~95% (core features), ~85% (extensions)

Quick Reference: What’s New in v1.9.0

SQLite Enhancements

  1. PRAGMA - Fully parsed: bare (PRAGMA x), arg (PRAGMA x(n)), assignment (PRAGMA x=v)
  2. WITHOUT ROWID - CREATE TABLE ... WITHOUT ROWID fully supported
  3. Reserved keywords as DDL column names - No longer cause parse errors

Security Scanner

  1. Tautology detection - 1=1, 'a'='a', col=col, OR TRUE → CRITICAL (PatternTautology)
  2. UNION split - PatternUnionInjection (CRITICAL) vs PatternUnionGeneric (HIGH)

Parser Fixes

  1. KEY/INDEX/VIEW in qualified identifiers (e.g., a.key)
  2. NATURAL JOIN - type stored as "NATURAL" not "NATURAL INNER"
  3. OVER window_name - bare window name reference (SQL:2003 §7.11)
  4. MySQL backtick + SQL Server bracket reserved-word identifiers

Error Codes

  1. E1009 - ErrCodeUnterminatedBlockComment for unterminated /* ... */

Quick Reference: What’s New in v1.8.0

Dialect Engine

  1. ParseWithDialect() - Parse SQL with dialect-specific syntax
  2. ValidateWithDialect() - Validate with dialect awareness
  3. —dialect CLI flag - Specify dialect for CLI commands
  4. 6 Supported Dialects - PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake

MySQL Syntax (11 Features)

  1. SHOW statements - SHOW TABLES, DATABASES, CREATE TABLE
  2. DESCRIBE/EXPLAIN - Table description
  3. REPLACE INTO - Insert-or-replace
  4. ON DUPLICATE KEY UPDATE - MySQL upsert
  5. LIMIT offset, count - MySQL-style pagination
  6. UPDATE/DELETE with LIMIT - Row limiting extension
  7. GROUP_CONCAT - With ORDER BY and SEPARATOR
  8. MATCH AGAINST - Full-text search
  9. REGEXP/RLIKE - Regular expression operators
  10. INTERVAL number unit - MySQL-style intervals
  11. IF()/REPLACE() as functions - Keywords as function names

New Capabilities

  1. Query Transform API - pkg/transform/ for programmatic SQL rewriting
  2. Comment Preservation - Comments survive parse-format round-trips
  3. AST-to-SQL - SQL() methods on all nodes for roundtrip serialization
  4. WASM Playground - Browser-based SQL parsing and formatting
  5. Error Recovery - ParseWithRecovery() for multi-error diagnostics
  6. Dollar-Quoted Strings - PostgreSQL $$body$$ support
  7. ~50% Faster Parsing - O(1) integer token comparison

Migration Notes

  • From v1.7.0: High-level API (gosqlx.Parse(), gosqlx.Validate()) is fully backward compatible
  • Breaking: token.Token.ModelType renamed to Type; string-based token.Type removed. See MIGRATION.md
  • MySQL Users: Use parser.ParseWithDialect(sql, "mysql") for MySQL-specific syntax
  • Performance: ~50% faster parsing from token type overhaul