[oracle] `OracleDialect` should use `OFFSET/FETCH` syntax
What happened?
The sql.oracle target uses OFFSET/LIMIT syntax, when it should use OFFSET/FETCH
PRQL input
from bar | take 15..20
SQL output
SELECT
*
FROM
"bar"
LIMIT
6 OFFSET 14
Expected SQL output
SELECT
*
FROM
"bar"
ORDER BY
(
SELECT
NULL
) OFFSET 14 ROWS
FETCH FIRST
6 ROWS ONLY
MVCE confirmation
- [x] Minimal example
- [x] New issue
Anything else?
implementing use_fetch() -> true for OracleDialect should be enough
Thanks for the report — reproduced, and your diagnosis was exactly right. OracleDialect never overrode use_fetch(), which defaults to false, so take fell through to the generic LIMIT/OFFSET path.
#6292 adds the override. gen_query.rs already handles everything downstream — the OFFSET n ROWS, the synthesised OFFSET 0 ROWS when there's no offset, and the ORDER BY (SELECT NULL) that Oracle requires alongside FETCH — so your expected output falls out verbatim. CI is green; a maintainer will review.
One adjacent gap worth flagging while you're looking at this target: OracleDialect also doesn't override has_concat_function(), so f-strings still emit a variadic CONCAT — derive x = f"{a}-{b}-{c}" compiles to CONCAT("a", '-', "b", '-', "c"). That's the same pre-23ai two-argument constraint #6267 fixed for text.contains. I left it out of #6292 to keep that PR to one concern; happy to take it separately if it's affecting you.
Details
Root cause — dialect.rs had only the ident_quoting_style override, while MsSqlDialect sets use_fetch(). The consumer is gen_query.rs, which branches on it for both the OffsetRows::Rows suffix and the fetch/limit split.
Test coverage added in test_take_oracle (prqlc/prqlc/tests/integration/sql.rs), covering three shapes:
| PRQL | Before | After |
|---|---|---|
take 15..20 |
LIMIT 6 OFFSET 14 |
ORDER BY (SELECT NULL) OFFSET 14 ROWS FETCH FIRST 6 ROWS ONLY |
take ..5 |
LIMIT 5 |
ORDER BY (SELECT NULL) OFFSET 0 ROWS FETCH FIRST 5 ROWS ONLY |
take 3.. |
OFFSET 2 |
OFFSET 2 ROWS |
The sql.oracle entry in web/book/src/project/target.md described the dialect as quoting-only, so it's updated too.