Skip to content

Releases: SPANDigital/cel2sql

Release v3.8.1

27 Apr 19:18
651bc04

Choose a tag to compare

What's Changed

  • chore(deps): bump github.com/google/cel-go from 0.27.0 to 0.28.0 by @dependabot[bot] in #125
  • chore(deps): bump modernc.org/sqlite from 1.46.1 to 1.50.0 by @dependabot[bot] in #124
  • chore(deps): bump cloud.google.com/go/bigquery from 1.74.0 to 1.76.0 by @dependabot[bot] in #123
  • chore(deps): bump github.com/lib/pq from 1.11.2 to 1.12.3 by @dependabot[bot] in #122
  • chore: prepare CHANGELOG for v3.8.1 release by @richardwooding in #126

Full Changelog: v3.8.0...v3.8.1

Release v3.8.0

27 Apr 11:21
c10a520

Choose a tag to compare

What's Changed

Full Changelog: v3.7.1...v3.8.0

Release v3.7.1

27 Apr 09:01
4895fc9

Choose a tag to compare

What's Changed

  • test: stop t.Log triggering false GitHub Actions error annotations by @richardwooding in #115
  • chore(deps): bump google.golang.org/grpc from 1.79.3 to 1.80.0 by @dependabot[bot] in #108
  • chore(deps): bump google.golang.org/api from 0.269.0 to 0.276.0 by @dependabot[bot] in #112
  • chore: prepare CHANGELOG for v3.7.1 release by @richardwooding in #116

Full Changelog: v3.7.0...v3.7.1

Release v3.7.0

27 Apr 08:09

Choose a tag to compare

What's Changed

  • chore(deps): bump google.golang.org/api from 0.268.0 to 0.269.0 by @dependabot[bot] in #105
  • chore(deps): bump cloud.google.com/go/bigquery from 1.73.1 to 1.74.0 by @dependabot[bot] in #106
  • feat: backport features and fix from observeinc/cel2sql fork by @richardwooding in #113
  • chore(deps): bump testcontainers-go to drop vulnerable docker/docker SDK by @richardwooding in #114
  • chore(deps): bump filippo.io/edwards25519 from 1.1.0 to 1.1.1 by @dependabot[bot] in #107

Full Changelog: v3.6.0...v3.7.0

Release v3.6.0

25 Feb 10:03
2ef3182

Choose a tag to compare

What's Changed

Multi-Dialect SQL Support (#104)

cel2sql now supports 5 SQL dialects from a single API: PostgreSQL (default), MySQL, SQLite, DuckDB, and BigQuery.

Highlights:

  • New Dialect interface with ~40 methods for pluggable SQL generation
  • WithDialect() option for Convert() and ConvertParameterized()
  • Per-dialect type providers with LoadTableSchema support for runtime schema introspection
  • Per-dialect index analysis and DDL recommendations via IndexAdvisor interface
  • Shared test infrastructure with per-dialect expected SQL (testcases/, testutil/)
  • Integration tests: PostgreSQL & MySQL (testcontainers), SQLite (in-memory), BigQuery (emulator)
  • Dialect-agnostic schema types in schema/ package

New packages:

  • dialect/postgres/, dialect/mysql/, dialect/sqlite/, dialect/duckdb/, dialect/bigquery/ — dialect implementations
  • mysql/, sqlite/, duckdb/, bigquery/ — type providers
  • schema/ — shared schema types
  • testcases/, testutil/ — multi-dialect test infrastructure

Other Changes

  • chore: modernize Go idioms via go fix (#103)
  • chore(deps): bump github.com/google/cel-go from 0.26.0 to 0.27.0 (#100)
  • chore(deps): bump github.com/lib/pq from 1.10.9 to 1.11.2 (#101)

Full Changelog: v3.5.0...v3.6.0

What's Changed

Full Changelog: v3.5.0...v3.6.0

Release v3.5.0

08 Jan 11:24

Choose a tag to compare

What's Changed

  • test: Improve test coverage from 72% to 76% (toward 80% target) by @richardwooding in #92
  • chore(deps): bump github.com/jackc/pgx/v5 from 5.7.5 to 5.8.0 by @dependabot[bot] in #95
  • feat: upgrade to Go 1.25.5 and fix 21 security vulnerabilities by @richardwooding in #96
  • chore(deps): bump github.com/testcontainers/testcontainers-go/modules/postgres from 0.38.0 to 0.40.0 by @dependabot[bot] in #94
  • chore: update dependencies to latest versions by @richardwooding in #97

Full Changelog: v3.4.0...v3.5.0

Release v3.4.0

31 Oct 09:47

Choose a tag to compare

🎉 What's New in v3.4.0

This release brings three major features and improvements to cel2sql!

🔢 Multi-Dimensional Array Support (fixes #49)

Full support for PostgreSQL multi-dimensional arrays with automatic dimension detection!

Features:

  • ✨ Automatic dimension detection from PostgreSQL type strings
  • 📊 Support for 1D, 2D, 3D, and 4D+ arrays
  • 🔧 Works with both bracket notation (integer[][]) and underscore notation (_int4[])
  • 🔄 Full backward compatibility (defaults to 1D)

Example:

// 2D array in schema
schema := pg.NewSchema([]pg.FieldSchema{
    {Name: "matrix", Type: "integer", Repeated: true, Dimensions: 2},
})

// CEL expression
ast, _ := env.Compile("size(data.matrix) > 0")

// Generated SQL
// COALESCE(ARRAY_LENGTH(data.matrix, 2), 0) > 0

Testing:

  • 22 unit tests for dimension detection
  • Integration tests for 1D-4D arrays
  • Backward compatibility tests

🔤 CEL String Extension Functions (fixes #87)

Implemented three powerful CEL string extension functions with PostgreSQL conversion!

Functions:

  • split(delimiter [, limit])STRING_TO_ARRAY()
    • Full limit support (0, 1, -1, N)
    • Handles edge cases correctly
  • join([delimiter])ARRAY_TO_STRING()
    • Optional delimiter (defaults to empty string)
    • Null handling
  • format(args)FORMAT()
    • Supported specifiers: %s, %d, %f
    • Format string validation (max 1000 chars)
    • Argument count validation

Features:

  • ✅ All functions work in comprehensions (exists, all, filter, map)
  • 🔒 Security validations: null byte checks, format string limits, specifier whitelisting
  • 📚 100+ test cases
  • 📈 Performance benchmarks
  • 💡 Working example in examples/string_extensions/

Example:

// CEL
"a,b,c".split(",")

// SQL
STRING_TO_ARRAY('a,b,c', ',')

🛡️ Comprehension Pattern Matching Validation (fixes #44)

Strengthened comprehension pattern matching to prevent potential misidentification of custom accumulator expressions.

Improvements:

  • Enhanced result expression validation for all comprehension types
  • Stricter validation of accumulator increment patterns
  • Added 22 comprehensive edge case tests

Test Coverage:

  • Pattern detection order verification
  • Complex nested expressions
  • Empty lists handling
  • Chained operations
  • Variable name edge cases

📦 Installation

go get github.com/spandigital/cel2sql/v3@v3.4.0

📖 Documentation

🙏 Contributors

Thanks to all contributors who made this release possible!

🤖 Generated with Claude Code

Release v3.3.0

31 Oct 01:14

Choose a tag to compare

What's New in v3.3.0

This release fixes critical bugs and adds comprehensive support for CEL string extension functions.

🐛 Bug Fixes

LIKE Pattern Escaping (fixes #40, #43, #84)

  • Fixed LIKE pattern escaping to use ESCAPE E'\\' syntax for proper backslash handling
  • Updated startsWith() and endsWith() to properly escape special LIKE characters (%, _, \)
  • Prevents SQL syntax errors from patterns containing backslashes

JSON Comprehensions (fixes #48, #84)

  • Fixed comprehensions over JSON arrays to properly use jsonb_array_elements()
  • Corrects SQL generation for expressions like data.items.all(i, i.quantity > 0)
  • Ensures JSON array comprehensions work correctly with PostgreSQL

String Functions Panic (fixes #85, #86)

  • Critical Fix: Eliminated panic when using CEL string extension functions as methods
  • Added defensive checks in callCasting, visitCallIndex, visitCallMapIndex, visitCallListIndex, visitCallUnary
  • All string functions now properly handle both method calls (target) and function calls (args)
  • No more panic: index out of range [0] errors!

✨ New Features

CEL String Extension Functions (#86)

Implemented 10 CEL string extension functions with PostgreSQL SQL conversion:

CEL Function PostgreSQL SQL Example
lowerAscii() LOWER() "HELLO".lowerAscii()LOWER('HELLO')
upperAscii() UPPER() "hello".upperAscii()UPPER('hello')
trim() TRIM() " text ".trim()TRIM(' text ')
charAt(index) SUBSTRING(str, index+1, 1) "test".charAt(0)SUBSTRING('test', 1, 1)
indexOf(search, [offset]) POSITION() "hello".indexOf('e') → returns 1
lastIndexOf(search) REVERSE() logic "hello".lastIndexOf('l') → returns 3
substring(start, [end]) SUBSTRING() "hello".substring(0, 3)SUBSTRING('hello', 1, 3)
replace(old, new, [limit]) REPLACE() "hello".replace('l', 'L')REPLACE('hello', 'l', 'L')
reverse() REVERSE() "hello".reverse()REVERSE('hello')

Features:

  • Works in comprehensions: data.tags.map(t, t.upperAscii())
  • Works as standalone expressions: item.name.trim() == "test"
  • Clear error messages for unsupported functions (split, join, format, quote)
  • Comprehensive test coverage in string_functions_test.go

📊 Testing

  • ✅ All 6 failing test cases from issue #85 now pass
  • ✅ Comprehensive test suite for all string functions
  • ✅ Panic prevention tests
  • ✅ All tests pass: make test
  • ✅ All lint checks pass: make lint

🔗 Related Issues

  • Fixes #40 - LIKE pattern escaping
  • Fixes #43 - Backslash handling in patterns
  • Fixes #48 - JSON array comprehensions
  • Fixes #85 - String functions panic
  • Closes #84 - Phase 1 Correctness
  • Closes #86 - String extension functions PR

📦 Installation

go get github.com/spandigital/cel2sql/v3@v3.3.0

🙏 Credits

This release includes contributions and bug reports from the community. Thank you!


Full Changelog: v3.2.0...v3.3.0

Release v3.2.0

30 Oct 22:29

Choose a tag to compare

What's Changed

Fixed

Standardized Error Message Format (fixes #38)

This release significantly improves error handling throughout cel2sql:

  • Added 16 exported sentinel errors to enable programmatic error checking with errors.Is():

    • ErrUnsupportedExpression, ErrInvalidFieldName, ErrInvalidSchema
    • ErrInvalidRegexPattern, ErrMaxDepthExceeded, ErrMaxOutputLengthExceeded
    • ErrInvalidComprehension, ErrMaxComprehensionDepthExceeded
    • ErrInvalidArguments, ErrInvalidTimestampOperation, ErrInvalidDuration
    • ErrInvalidJSONPath, ErrInvalidOperator, ErrUnsupportedType
    • ErrContextCanceled, ErrInvalidByteArrayLength
  • Improved error wrapping across ~60 error sites using fmt.Errorf() with %w

  • Enhanced error messages with operation context for better debugging

  • Maintained security - no credential exposure in error messages

Benefits: Better debugging, programmatic error handling, improved code maintainability

Byte Array Length Validation (fixes #36)

Security improvement to prevent resource exhaustion:

  • Added 10,000 byte maximum for byte arrays in non-parameterized mode
  • Protection against memory exhaustion from hex-encoded SQL (4x expansion)
  • Parameterized mode bypasses limit (bytes passed directly to database)
  • Clear error messages guide users when limits exceeded

Security Context: Addresses CWE-400 (Uncontrolled Resource Consumption)

Added

Comprehensive Performance Benchmarks in CI/CD (fixes #52)

Automated performance monitoring and tracking:

  • Historical benchmark tracking with data storage on GitHub Pages
  • Visual performance charts at https://spandigital.github.io/cel2sql/dev/bench/
  • PR comments when performance changes exceed 150%
  • Comprehensive coverage: operators, comprehensions, JSON, regex, timestamps, complex expressions

Full Changelog

See CHANGELOG.md for complete release notes including v3.1.0.

Full Changelog: v3.1.0...v3.2.0

Release v3.1.0

30 Oct 17:26
fadc687

Choose a tag to compare

Features

  • Query Analysis and Index Recommendations (#81, fixes #50)
    • New AnalyzeQuery() function to analyze CEL expressions and recommend database indexes
    • Automatic detection of B-tree, GIN, and GIN with pg_trgm index opportunities
    • Support for JSON path operations, array operations, and regex pattern matching
    • Complete working example in examples/index_analysis/
    • See CLAUDE.md for detailed usage

Documentation

  • Regex Conversion Limitations (#80, fixes #46)
    • Added detailed documentation of automatic RE2 to POSIX regex conversions
    • Listed unsupported RE2 features that will return errors
    • Added examples of supported and unsupported patterns

What's Changed

Full Changelog: v3.0.1...v3.1.0