Skip to content

Conversation

@richardwooding
Copy link
Contributor

Summary

Fixes #32 - Bytea literals now use PostgreSQL-compatible hex format instead of invalid b"..." syntax.

Changes

  • cel2sql.go:
    • Added encoding/hex import
    • Updated bytea literal generation to use '\x...' hex format
  • utils.go:
    • Removed unused bytesToOctets() function
  • Tests:
    • Updated test expectations in final_coverage_test.go and edgecase_coverage_test.go

Impact

High severity fix - Queries with byte values will now execute successfully instead of failing with syntax errors.

Before

// Generated invalid SQL
b"\150\145\154\154\157"  // PostgreSQL syntax error

After

// Generates valid PostgreSQL hex format
'\x68656c6c6f'  // Valid PostgreSQL bytea literal

Test plan

  • ✅ All existing tests pass
  • ✅ Lint checks pass
  • ✅ Updated test expectations match new hex format
  • ✅ Integration tests verify PostgreSQL compatibility

🤖 Generated with Claude Code

Replace invalid b"..." format with PostgreSQL-compatible '\x...' hex format
for bytea literals. The old format caused syntax errors when executing
queries with byte values.

Changes:
- Add encoding/hex import to cel2sql.go
- Update bytea literal generation to use '\x' + hex encoding
- Remove unused bytesToOctets function from utils.go
- Update test expectations to match new hex format

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@richardwooding richardwooding merged commit 9ba03aa into main Oct 24, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bytea Literal Format Incompatible with PostgreSQL

1 participant