Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #1292 #1454

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# dbplyr (development version)

* Oracle once again translates `head()` to `FETCH FIRST`. This does require
Oracle 12c or newer, but it actually works, compared to the approach using `ROWNUM`
from #1292 (#1436).

* Specification of table names with schema/catalogs has been overhauled to
make it simpler. This includes the following features and fixes:

Expand Down
10 changes: 5 additions & 5 deletions R/backend-oracle.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ sql_query_select.Oracle <- function(con,
subquery = FALSE,
lvl = 0) {

if (!is.null(limit)) {
limit <- as.integer(limit)
where = c(paste0("ROWNUM <= ", limit), where)
}

sql_select_clauses(con,
select = sql_clause_select(con, select, distinct),
from = sql_clause_from(from),
Expand All @@ -66,6 +61,11 @@ sql_query_select.Oracle <- function(con,
having = sql_clause_having(having),
window = sql_clause_window(window),
order_by = sql_clause_order_by(order_by, subquery, limit),
# Requires Oracle 12c, released in 2013
limit = if (!is.null(limit)) {
limit <- format(as.integer(limit))
glue_sql2(con, "FETCH FIRST {limit} ROWS ONLY")
},
lvl = lvl
)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/backend-oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SQL>
SELECT `df`.*
FROM `df`
WHERE (ROWNUM <= 6)
FETCH FIRST 6 ROWS ONLY

# `sql_query_upsert()` is correct

Expand Down
Loading