RMariaDB icon indicating copy to clipboard operation
RMariaDB copied to clipboard

Explain leads to `bad value` error

Open mgirlich opened this issue 2 years ago • 2 comments

Found when running the dbplyr tests. This was introduced with v1.3.0 and still happens in the dev version.

Edit: Sorry, didn't check the reprex again when running it the second time. The issue only seems to appear when I connect to an SQLite db before 😕

con_sqlite <- DBI::dbConnect(
  RSQLite::SQLite(), ":memory:"
)
con <- DBI::dbConnect(
  RMariaDB::MariaDB(),
  dbname = "test",
  host = "localhost",
  username = Sys.getenv("USER")
)

DBI::dbWriteTable(con, "test", data.frame(x = 1:3))
DBI::dbGetQuery(
  con,
  "EXPLAIN SELECT `test`.*, `x` + 1.0 AS `y` FROM `test`"
)
#> Error in result_fetch(res@ptr, n = n): bad value

Created on 2023-10-27 with reprex v2.0.2

mgirlich avatar Oct 27 '23 07:10 mgirlich

Thanks. What is the expected behavior here?

krlmlr avatar Oct 27 '23 08:10 krlmlr

Argh, sorry, I ran the reprex again and didn't check that it didn't contain the issue anymore. This only seems to happen when connection to SQLite before. Interesting.

mgirlich avatar Oct 27 '23 08:10 mgirlich

Works for me:

pkgload::load_all()
#> ℹ Loading RMariaDB
#> ! Skipping missing files: '/root/workspace/R/names.R'

con_sqlite <- DBI::dbConnect(
  RSQLite::SQLite(), ":memory:"
)
con <- DBI::dbConnect(
  RMariaDB::MariaDB()
)

DBI::dbWriteTable(con, "test", data.frame(x = 1:3), overwrite = TRUE)
DBI::dbGetQuery(
  con,
  "EXPLAIN SELECT `test`.*, `x` + 1.0 AS `y` FROM `test`"
)
#>   id select_type table type possible_keys  key key_len  ref rows Extra
#> 1  1      SIMPLE  test  ALL          <NA> <NA>    <NA> <NA>    3

Created on 2024-04-01 with reprex v2.1.0

Can you please double-check in your setup?

krlmlr avatar Apr 01 '24 16:04 krlmlr

Seems to be fixed now 👍

mgirlich avatar Apr 08 '24 04:04 mgirlich

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

github-actions[bot] avatar Apr 09 '25 03:04 github-actions[bot]