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

Explain leads to bad value error #316

Closed
mgirlich opened this issue Oct 27, 2023 · 4 comments
Closed

Explain leads to bad value error #316

mgirlich opened this issue Oct 27, 2023 · 4 comments

Comments

@mgirlich
Copy link

mgirlich commented Oct 27, 2023

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

@krlmlr
Copy link
Member

krlmlr commented Oct 27, 2023

Thanks. What is the expected behavior here?

@mgirlich
Copy link
Author

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.

@krlmlr
Copy link
Member

krlmlr commented Apr 1, 2024

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?

@mgirlich
Copy link
Author

mgirlich commented Apr 8, 2024

Seems to be fixed now 👍

@mgirlich mgirlich closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants