From fb2aa627a349ea2ded59a9e875e220860fc99c83 Mon Sep 17 00:00:00 2001 From: Julien Pinchelimouroux Date: Wed, 22 Apr 2026 15:49:49 +0200 Subject: [PATCH 1/5] feat: add basic oracle_sql dialect support --- prqlc/bindings/elixir/lib/prql.ex | 1 + prqlc/bindings/elixir/lib/prql/native.ex | 1 + prqlc/bindings/elixir/native/prql/src/lib.rs | 3 +++ prqlc/prqlc/src/cli/test.rs | 7 ++++--- prqlc/prqlc/src/sql/dialect.rs | 20 +++++++++++++++++--- prqlc/prqlc/tests/integration/sql.rs | 11 +++++++++++ 6 files changed, 37 insertions(+), 6 deletions(-) diff --git a/prqlc/bindings/elixir/lib/prql.ex b/prqlc/bindings/elixir/lib/prql.ex index 47d756c3375c..04ed2be677cf 100644 --- a/prqlc/bindings/elixir/lib/prql.ex +++ b/prqlc/bindings/elixir/lib/prql.ex @@ -18,6 +18,7 @@ defmodule PRQL do | :clickhouse | :duckdb | :glaredb + | :oracle_sql | :redshift | :sqlite | :snowflake diff --git a/prqlc/bindings/elixir/lib/prql/native.ex b/prqlc/bindings/elixir/lib/prql/native.ex index a3d18905b093..6ea323ae327c 100644 --- a/prqlc/bindings/elixir/lib/prql/native.ex +++ b/prqlc/bindings/elixir/lib/prql/native.ex @@ -26,6 +26,7 @@ defmodule PRQL.Native.CompileOptions do | :bigquery | :clickhouse | :glaredb + | :oracle_sql | :redshift | :sqlite | :snowflake diff --git a/prqlc/bindings/elixir/native/prql/src/lib.rs b/prqlc/bindings/elixir/native/prql/src/lib.rs index 24b105515ab3..40b2115666b1 100644 --- a/prqlc/bindings/elixir/native/prql/src/lib.rs +++ b/prqlc/bindings/elixir/native/prql/src/lib.rs @@ -22,6 +22,7 @@ mod atoms { generic, mssql, mysql, + oracle_sql, postgres, redshift, sqlite, @@ -63,6 +64,8 @@ fn target_from_atom(a: Atom) -> prqlc::Target { MsSql } else if a == atoms::mysql() { MySql + } else if a == atoms::oracle_sql() { + OracleSql } else if a == atoms::postgres() { Postgres } else if a == atoms::redshift() { diff --git a/prqlc/prqlc/src/cli/test.rs b/prqlc/prqlc/src/cli/test.rs index 8d0b3f381a10..b812822fd18c 100644 --- a/prqlc/prqlc/src/cli/test.rs +++ b/prqlc/prqlc/src/cli/test.rs @@ -86,6 +86,7 @@ fn get_targets() { sql.glaredb sql.mssql sql.mysql + sql.oracle_sql sql.postgres sql.redshift sql.sqlite @@ -144,18 +145,18 @@ fn compile_help() { -t, --target Target to compile to - + [env: PRQLC_TARGET=] [default: sql.any] --debug-log File path into which to write the debug log to - + [env: PRQLC_DEBUG_LOG=] --color Controls when to use color - + [default: auto] [possible values: auto, always, never] diff --git a/prqlc/prqlc/src/sql/dialect.rs b/prqlc/prqlc/src/sql/dialect.rs index 6255016c3758..265fee4cfd79 100644 --- a/prqlc/prqlc/src/sql/dialect.rs +++ b/prqlc/prqlc/src/sql/dialect.rs @@ -89,6 +89,7 @@ pub enum Dialect { GlareDb, MsSql, MySql, + OracleSql, Postgres, Redshift, SQLite, @@ -112,6 +113,7 @@ impl Dialect { Dialect::Postgres => Box::new(PostgresDialect), Dialect::Redshift => Box::new(RedshiftDialect), Dialect::GlareDb => Box::new(GlareDbDialect), + Dialect::OracleSql => Box::new(OracleSqlDialect), Dialect::Ansi | Dialect::Generic => Box::new(GenericDialect), } } @@ -126,9 +128,11 @@ impl Dialect { | Dialect::Generic | Dialect::GlareDb | Dialect::ClickHouse => SupportLevel::Supported, - Dialect::MsSql | Dialect::Ansi | Dialect::BigQuery | Dialect::Snowflake => { - SupportLevel::Unsupported - } + Dialect::MsSql + | Dialect::Ansi + | Dialect::BigQuery + | Dialect::Snowflake + | Dialect::OracleSql => SupportLevel::Unsupported, } } @@ -166,6 +170,8 @@ pub struct PostgresDialect; pub struct RedshiftDialect; #[derive(Debug)] pub struct GlareDbDialect; +#[derive(Debug)] +pub struct OracleSqlDialect; pub(super) enum ColumnExclude { Exclude, @@ -736,6 +742,14 @@ impl DialectHandler for DuckDbDialect { } } +impl DialectHandler for OracleSqlDialect { + fn ident_quoting_style(&self) -> IdentQuotingStyle { + // Due to oraclesql identifier casing rules, identifiers are always quoted + // https://docs.oracle.com/en/database/oracle/oracle-database/26/sqlrf/Database-Object-Names-and-Qualifiers.html + IdentQuotingStyle::AlwaysQuoted + } +} + #[cfg(test)] mod tests { use std::str::FromStr; diff --git a/prqlc/prqlc/tests/integration/sql.rs b/prqlc/prqlc/tests/integration/sql.rs index be2dcda4b037..b6305f649c70 100644 --- a/prqlc/prqlc/tests/integration/sql.rs +++ b/prqlc/prqlc/tests/integration/sql.rs @@ -240,6 +240,17 @@ FROM "employees" "# )] +#[case::oracle_sql( + sql::Dialect::OracleSql, + r#" +SELECT + "a", + "b", + "col space" +FROM + "employees" +"# +)] fn test_quoting_style(#[case] dialect: sql::Dialect, #[case] expected_sql: &'static str) { let query = r#" from employees From 0e4b5c0aaab0c085c0298d7b08895167922b6729 Mon Sep 17 00:00:00 2001 From: Julien Pinchelimouroux Date: Wed, 22 Apr 2026 15:54:17 +0200 Subject: [PATCH 2/5] fix file lint --- prqlc/prqlc/src/cli/test.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prqlc/prqlc/src/cli/test.rs b/prqlc/prqlc/src/cli/test.rs index b812822fd18c..070749023d24 100644 --- a/prqlc/prqlc/src/cli/test.rs +++ b/prqlc/prqlc/src/cli/test.rs @@ -145,18 +145,18 @@ fn compile_help() { -t, --target Target to compile to - + [env: PRQLC_TARGET=] [default: sql.any] --debug-log File path into which to write the debug log to - + [env: PRQLC_DEBUG_LOG=] --color Controls when to use color - + [default: auto] [possible values: auto, always, never] From 4415774b92a03d7af2a494297e07789140cc3514 Mon Sep 17 00:00:00 2001 From: Julien Pinchelimouroux Date: Wed, 22 Apr 2026 16:41:28 +0200 Subject: [PATCH 3/5] fix: rename dialect to Oracle --- prqlc/bindings/elixir/lib/prql.ex | 4 ++-- prqlc/bindings/elixir/lib/prql/native.ex | 2 +- prqlc/bindings/elixir/native/prql/src/lib.rs | 6 +++--- prqlc/prqlc/src/cli/test.rs | 2 +- prqlc/prqlc/src/sql/dialect.rs | 10 +++++----- web/book/src/project/target.md | 1 + 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/prqlc/bindings/elixir/lib/prql.ex b/prqlc/bindings/elixir/lib/prql.ex index 04ed2be677cf..60d1c2694f4d 100644 --- a/prqlc/bindings/elixir/lib/prql.ex +++ b/prqlc/bindings/elixir/lib/prql.ex @@ -18,7 +18,7 @@ defmodule PRQL do | :clickhouse | :duckdb | :glaredb - | :oracle_sql + | :oracle | :redshift | :sqlite | :snowflake @@ -40,7 +40,7 @@ defmodule PRQL do * `:target` - Dialect used for generate SQL. Accepted values are `:generic`, `:mssql`, `:mysql`, `:postgres`, `:ansi`, `:bigquery`, - `:clickhouse`, `:duckdb`, `:glaredb`, `:redshift`, `:sqlite`, `:snowflake` + `:clickhouse`, `:duckdb`, `:glaredb`, `:oracle`, `:redshift`, `:sqlite`, `:snowflake` * `:format` - Formats the output, defaults to `true` diff --git a/prqlc/bindings/elixir/lib/prql/native.ex b/prqlc/bindings/elixir/lib/prql/native.ex index 6ea323ae327c..870c6e2f2d25 100644 --- a/prqlc/bindings/elixir/lib/prql/native.ex +++ b/prqlc/bindings/elixir/lib/prql/native.ex @@ -26,7 +26,7 @@ defmodule PRQL.Native.CompileOptions do | :bigquery | :clickhouse | :glaredb - | :oracle_sql + | :oracle | :redshift | :sqlite | :snowflake diff --git a/prqlc/bindings/elixir/native/prql/src/lib.rs b/prqlc/bindings/elixir/native/prql/src/lib.rs index 40b2115666b1..4fe206785ade 100644 --- a/prqlc/bindings/elixir/native/prql/src/lib.rs +++ b/prqlc/bindings/elixir/native/prql/src/lib.rs @@ -22,7 +22,7 @@ mod atoms { generic, mssql, mysql, - oracle_sql, + oracle, postgres, redshift, sqlite, @@ -64,8 +64,8 @@ fn target_from_atom(a: Atom) -> prqlc::Target { MsSql } else if a == atoms::mysql() { MySql - } else if a == atoms::oracle_sql() { - OracleSql + } else if a == atoms::oracle() { + Oracle } else if a == atoms::postgres() { Postgres } else if a == atoms::redshift() { diff --git a/prqlc/prqlc/src/cli/test.rs b/prqlc/prqlc/src/cli/test.rs index 070749023d24..88f11b61f357 100644 --- a/prqlc/prqlc/src/cli/test.rs +++ b/prqlc/prqlc/src/cli/test.rs @@ -86,7 +86,7 @@ fn get_targets() { sql.glaredb sql.mssql sql.mysql - sql.oracle_sql + sql.oracle sql.postgres sql.redshift sql.sqlite diff --git a/prqlc/prqlc/src/sql/dialect.rs b/prqlc/prqlc/src/sql/dialect.rs index 265fee4cfd79..7f3f17e8fa97 100644 --- a/prqlc/prqlc/src/sql/dialect.rs +++ b/prqlc/prqlc/src/sql/dialect.rs @@ -89,7 +89,7 @@ pub enum Dialect { GlareDb, MsSql, MySql, - OracleSql, + Oracle, Postgres, Redshift, SQLite, @@ -113,7 +113,7 @@ impl Dialect { Dialect::Postgres => Box::new(PostgresDialect), Dialect::Redshift => Box::new(RedshiftDialect), Dialect::GlareDb => Box::new(GlareDbDialect), - Dialect::OracleSql => Box::new(OracleSqlDialect), + Dialect::Oracle => Box::new(OracleDialect), Dialect::Ansi | Dialect::Generic => Box::new(GenericDialect), } } @@ -132,7 +132,7 @@ impl Dialect { | Dialect::Ansi | Dialect::BigQuery | Dialect::Snowflake - | Dialect::OracleSql => SupportLevel::Unsupported, + | Dialect::Oracle => SupportLevel::Unsupported, } } @@ -171,7 +171,7 @@ pub struct RedshiftDialect; #[derive(Debug)] pub struct GlareDbDialect; #[derive(Debug)] -pub struct OracleSqlDialect; +pub struct OracleDialect; pub(super) enum ColumnExclude { Exclude, @@ -742,7 +742,7 @@ impl DialectHandler for DuckDbDialect { } } -impl DialectHandler for OracleSqlDialect { +impl DialectHandler for OracleDialect { fn ident_quoting_style(&self) -> IdentQuotingStyle { // Due to oraclesql identifier casing rules, identifiers are always quoted // https://docs.oracle.com/en/database/oracle/oracle-database/26/sqlrf/Database-Object-Names-and-Qualifiers.html diff --git a/web/book/src/project/target.md b/web/book/src/project/target.md index 485499af92fa..3c54e18916a1 100644 --- a/web/book/src/project/target.md +++ b/web/book/src/project/target.md @@ -51,6 +51,7 @@ additional dialects. - `sql.ansi` - `sql.bigquery` - `sql.snowflake` +- `sql.oracle` ## Priority of targets From 0b7ae0d5894526c8ebde91d6f676ffcecfef4f96 Mon Sep 17 00:00:00 2001 From: Julien Pinchelimouroux Date: Wed, 22 Apr 2026 16:51:03 +0200 Subject: [PATCH 4/5] Update prqlc/prqlc/tests/integration/sql.rs Co-authored-by: prql-bot <107324867+prql-bot@users.noreply.github.com> --- prqlc/prqlc/tests/integration/sql.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prqlc/prqlc/tests/integration/sql.rs b/prqlc/prqlc/tests/integration/sql.rs index b6305f649c70..d40bc4ff567d 100644 --- a/prqlc/prqlc/tests/integration/sql.rs +++ b/prqlc/prqlc/tests/integration/sql.rs @@ -240,8 +240,8 @@ FROM "employees" "# )] -#[case::oracle_sql( - sql::Dialect::OracleSql, +#[case::oracle( + sql::Dialect::Oracle, r#" SELECT "a", From bef16d4a8b67e3ce351b74a86c0385b0c8d54be1 Mon Sep 17 00:00:00 2001 From: prql-bot <107324867+prql-bot@users.noreply.github.com> Date: Wed, 22 Apr 2026 23:25:33 +0000 Subject: [PATCH 5/5] docs: note that Oracle dialect support is very early Adds a short note next to `sql.oracle` in the dialects list and a changelog entry, clarifying that the initial Oracle dialect only forces identifier quoting and most other features fall back to generic SQL. Requested by @max-sixty in https://github.com/PRQL/prql/pull/5821#issuecomment-4300556369. Co-Authored-By: Claude Opus 4.7 --- CHANGELOG.md | 4 ++++ web/book/src/project/target.md | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46d58973f856..e969ef78e247 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ **Features**: +- Add a very early `sql.oracle` dialect. It currently only forces identifier + quoting to accommodate Oracle's case-folding rules; most other features fall + back to generic SQL. (@julien-pinchelimouroux, #5821) + **Fixes**: **Documentation**: diff --git a/web/book/src/project/target.md b/web/book/src/project/target.md index 3c54e18916a1..43e6ad9033e7 100644 --- a/web/book/src/project/target.md +++ b/web/book/src/project/target.md @@ -51,7 +51,9 @@ additional dialects. - `sql.ansi` - `sql.bigquery` - `sql.snowflake` -- `sql.oracle` +- `sql.oracle` — very early; currently only ensures identifiers are quoted to + accommodate Oracle's case-folding rules. Most other language features fall + back to generic SQL and may not execute correctly against Oracle. ## Priority of targets