Skip to content
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: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: duckspatial
Title: R Interface to 'DuckDB' Database with Spatial Extension
Version: 1.2.0
Version: 1.2.1
Authors@R: c(
person(
"Adrián", "Cidre González",
Expand Down Expand Up @@ -38,7 +38,7 @@ Imports:
DBI,
dbplyr (>= 2.0.0),
dplyr,
duckdb (>= 1.5.1),
duckdb (>= 1.5.4.2),
geoarrow,
glue,
jsonlite,
Expand Down
22 changes: 19 additions & 3 deletions R/db_extension.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,28 @@ ddbs_install <- function(
} else {

## 3b. Default: try core, then community, then error
err_core <- err_community <- NULL

installed <- tryCatch({
suppressMessages(DBI::dbExecute(conn, glue::glue("{install_kw} {extension};")))
"core"
}, error = function(e) {
err_core <<- e
tryCatch({
suppressMessages(DBI::dbExecute(conn, glue::glue("{install_kw} {extension} FROM community;")))
"community"
}, error = function(e2) {
err_community <<- e2
NULL
})
})

if (is.null(installed)) {
cli::cli_abort(c(
"Failed to {if (upgrade) 'upgrade' else 'install'} the {extension} extension.",
"i" = "It could not be found in the core or community repositories.",
"i" = "It might not be available for this version of DuckDB",
"x" = "core: {conditionMessage(err_core)}",
"x" = "community: {conditionMessage(err_community)}",
"i" = "It might not be available for this version of DuckDB, or the install location may not be writable.",
"i" = "Check that the extension name is correct: {.url https://duckdb.org/docs/extensions/overview}"
))
}
Expand Down Expand Up @@ -183,7 +188,18 @@ ddbs_load <- function(
# 2. Setup extension

## 2.1. Load the extension
if (isFALSE(target_ext$loaded)) suppressMessages(DBI::dbExecute(conn, glue::glue("LOAD {extension};")))
if (isFALSE(target_ext$loaded)) {
tryCatch({
suppressMessages(DBI::dbExecute(conn, glue::glue("LOAD {extension};")))
}, error = function(e) {
cli::cli_abort(c(
"Failed to load the {extension} extension.",
"x" = conditionMessage(e),
"i" = "The binary may be corrupt or incompatible with this platform/DuckDB version.",
"i" = "Try reinstalling with {.code ddbs_install(extension = '{extension}', upgrade = TRUE)}"
))
})
}

## 2.2. Activate macros
if (isTRUE(create_macros)) create_duckspatial_macros(conn)
Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.onAttach <- function(libname, pkgname) {
packageStartupMessage(
paste("duckspatial", utils::packageVersion("duckspatial"), "attached"),
"\n* Compatible with DuckDB >= v1.5.1"
"\n* Compatible with DuckDB >= v1.5.4.2"
)

# Notify about default output change
Expand Down
3 changes: 3 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ Maintainer: 'Adrián Cidre González <adrian.cidre@gmail.com>'
0 errors ✔ | 0 warnings ✔ | 1 note ✖
```

## Other comments

This is a patch to debug the errors in some flavors: <https://cran.r-project.org/web/checks/check_results_duckspatial.html>. The error message is ambiguous, so this patch captures the complete error message to make it easier to check what's actually failing.
Loading