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

Integer64 & Integers treated differently by glue_sql #279

Closed
carlganz opened this issue Oct 18, 2022 · 1 comment · Fixed by #293
Closed

Integer64 & Integers treated differently by glue_sql #279

carlganz opened this issue Oct 18, 2022 · 1 comment · Fixed by #293
Labels
bug an unexpected problem or unintended behavior SQL 🛢️

Comments

@carlganz
Copy link

glue_sql wraps integer64 values in quotes, but does not for integers. Feel free to close this if that is intentional.

library(glue)
library(bit64)

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

glue_sql(.con = con, "select {1}")
glue_sql(.con = con, "select {as.integer64(1)}")

Issue also appears with odbc and SQL Server instead of SQLite.

@hadley hadley added bug an unexpected problem or unintended behavior SQL 🛢️ labels Jan 25, 2023
@hadley
Copy link
Member

hadley commented Jan 25, 2023

Providing a reprex and confirming and it's specifically a SQL issue:

library(glue)

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

glue_sql("select {1}", .con = con)
#> <SQL> select 1
glue_sql("select {bit64::as.integer64(1)}", .con = con)
#> <SQL> select '1'

glue("select {1}")
#> select 1
glue("select {bit64::as.integer64(1)}")
#> select 1

Created on 2023-01-25 with reprex v2.0.2

hadley added a commit that referenced this issue Jan 26, 2023
jennybc added a commit that referenced this issue Mar 13, 2023
Fixes #279

Co-authored-by: Jennifer (Jenny) Bryan <jenny.f.bryan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior SQL 🛢️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants