Skip to content

feat(oracle): add experimental Oracle database support#4500

Open
mactav683 wants to merge 1 commit into
sqlc-dev:mainfrom
mactav683:mactav/oracledb-support
Open

feat(oracle): add experimental Oracle database support#4500
mactav683 wants to merge 1 commit into
sqlc-dev:mainfrom
mactav683:mactav/oracledb-support

Conversation

@mactav683

@mactav683 mactav683 commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Adds experimental Oracle database support to the built-in Go code generator, following the same architecture as the existing SQLite/MySQL engines.

Enable with engine: "oracle".

What's included

  • Parser (internal/engine/oracle/parser/): PL/SQL grammar from antlr/grammars-v4, generated with ANTLR 4.13.1 for the Go target.
  • Parser wrapper + AST converter (parse.go, convert.go): converts the ANTLR parse tree into sqlc's shared AST (CREATE TABLE, SELECT, INSERT, UPDATE, DELETE; positional :1 and named :name bind variables).
  • Catalog + stdlib (catalog.go, stdlib.go): schema resolution and ~45 built-in Oracle functions/types.
  • Reserved keywords (reserved.go): ~115 Oracle reserved words for IsReservedKeyword.
  • Type mapping (internal/codegen/golang/oracle_type.go): Oracle types to Go types targeting github.com/sijms/go-ora/v2 (a database/sql driver), using standard sql.Null* wrappers and honoring emit_pointers_for_null_types.
  • Wiring: config.EngineOracle, NewCompiler switch case, JSON-schema enum entries, and sqlc parse --dialect oracle.
  • Docs: language-support.rst, config.md, datatypes.md, and changelog updated.

Tests

  • 8 converter + 3 catalog + 21 type-mapping unit tests.
  • End-to-end golden-file fixture internal/endtoend/testdata/oracle_authors/oracle/; TestReplay/base/oracle_authors/oracle and TestFormat pass.
  • go build ./... clean.

Notes / follow-ups

  • NUMBER maps to float64 (the built-in analyzer does not track precision/scale); use INTEGER/INT or an override for integer columns.
  • Not yet implemented (optional, matches MySQL's posture): a format.Dialect implementation (format.go) to unlock the TestFormat round-trip, and a live-DB analyzer. A real database is not required for generator correctness.

Closes #3881

@mactav683 mactav683 force-pushed the mactav/oracledb-support branch from 3df47a0 to f4c531e Compare July 2, 2026 12:09
@mactav683 mactav683 changed the title Add experimental Oracle database support (built-in Go codegen) feat(oracle): add experimental Oracle database support Jul 2, 2026
Add an experimental Oracle engine for the built-in Go code generator,
mirroring the existing SQLite/MySQL engines. Enable with engine: "oracle".

- parser: PL/SQL grammar (antlr/grammars-v4) generated with ANTLR 4.13.1
- convert: ANTLR parse tree to sqlc shared AST (DDL/DML, :1 and :name binds)
- catalog + stdlib: schema resolution and built-in Oracle functions/types
- reserved: Oracle reserved keywords for IsReservedKeyword
- codegen: Oracle to Go type mapping targeting github.com/sijms/go-ora/v2
- wiring: config.EngineOracle, NewCompiler case, JSON schema enum, --dialect
- docs: language-support, config, datatypes, changelog

Covered by converter/catalog/type-mapping unit tests and an end-to-end
golden-file fixture (testdata/oracle_authors/oracle).
@mactav683 mactav683 force-pushed the mactav/oracledb-support branch from f4c531e to 5eff438 Compare July 2, 2026 12:17
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.

Add OracleDB support

2 participants