Module compatibility

Module compatibility 

Source
Expand description

§SQL Compatibility Matrix

This module defines SochDB’s SQL dialect support and compatibility layer.

§Design Goals

  1. Portable Core: SQL-92 compatible baseline that works across ecosystems
  2. Dialect Sugar: Support common dialect variants (MySQL, PostgreSQL, SQLite)
  3. Single AST: All dialects normalize to one canonical AST representation
  4. Extensible: Add new dialects without forking parsers/executors

§SQL Feature Matrix

§Guaranteed (Core SQL)

CategoryStatementStatusNotes
DMLSELECTWith WHERE, ORDER BY, LIMIT, OFFSET
DMLINSERTSingle and multi-row
DMLUPDATEWith WHERE clause
DMLDELETEWith WHERE clause
DDLCREATE TABLEWith column types and constraints
DDLDROP TABLEBasic form
DDLALTER TABLE🔄ADD/DROP COLUMN
DDLCREATE INDEXSingle and multi-column
DDLDROP INDEXBasic form
TxBEGINStart transaction
TxCOMMITCommit transaction
TxROLLBACKRollback transaction

§Idempotent DDL

StatementStatusNotes
CREATE TABLE IF NOT EXISTSNo-op if exists
DROP TABLE IF EXISTSNo-op if not exists
CREATE INDEX IF NOT EXISTSNo-op if exists
DROP INDEX IF EXISTSNo-op if not exists

§Conflict/Upsert Family

All of these normalize to InsertStmt { on_conflict: Some(OnConflict { .. }) }

DialectSyntaxCanonical AST
PostgreSQLON CONFLICT DO NOTHINGOnConflict { action: DoNothing }
PostgreSQLON CONFLICT DO UPDATE SET ...OnConflict { action: DoUpdate(...) }
MySQLINSERT IGNOREOnConflict { action: DoNothing }
MySQLON DUPLICATE KEY UPDATEOnConflict { action: DoUpdate(...) }
SQLiteINSERT OR IGNOREOnConflict { action: DoNothing }
SQLiteINSERT OR REPLACEOnConflict { action: DoReplace }

§Out of Scope (Explicit Limitations)

FeatureStatusReason
Multi-table JOINsComplexity; single-table focus for v1
Subqueries in WHEREPlanning complexity
Window functionsFuture enhancement
CTEs (WITH clause)Future enhancement
Stored proceduresOut of scope

§Dialect Detection

SochDB auto-detects dialect from syntax:

  • INSERT IGNORE → MySQL mode
  • INSERT OR IGNORE → SQLite mode
  • ON CONFLICT → PostgreSQL mode

All normalize to the same internal representation.

Structs§

CompatibilityMatrix
Compatibility matrix for different SQL dialects

Enums§

FeatureSupport
SQL Feature support level
SqlDialect
SQL Dialect for parsing/normalization
SqlFeature
SQL Feature categories

Functions§

get_feature_support
Get feature support level