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

Not correctly escaping column names in sql for duckdb connection #67

Closed
DavisVaughan opened this issue Jan 30, 2024 · 2 comments · Fixed by #92
Closed

Not correctly escaping column names in sql for duckdb connection #67

DavisVaughan opened this issue Jan 30, 2024 · 2 comments · Fixed by #92
Assignees
Milestone

Comments

@DavisVaughan
Copy link

See tidyverse/dplyr#6979

@Tmonster
Copy link
Contributor

Tmonster commented Feb 1, 2024

Thank you for the report.
I'll can take a look at this sometime soon

@krlmlr krlmlr added this to the 0.10.0 milestone Feb 23, 2024
@krlmlr
Copy link
Collaborator

krlmlr commented Feb 24, 2024

I'm on it. Reprex:

options(conflicts.policy = list(warn = FALSE))
library("duckdb")
#> Loading required package: DBI
library("dplyr")

duckdb_con <- dbConnect(duckdb())
copy_to(duckdb_con, tibble(first = 1:3, `2nd` = 4:6), "ex_tab")

tbl(duckdb_con, "ex_tab")
#> # Source:   table<ex_tab> [3 x 2]
#> # Database: DuckDB v0.9.3-dev3731 [kirill@Darwin 23.2.0:R 4.3.2/:memory:]
#>   first `2nd`
#>   <int> <int>
#> 1     1     4
#> 2     2     5
#> 3     3     6

tbl(duckdb_con, "ex_tab") |> select(`2nd`)
#> # Source:   SQL [3 x 1]
#> # Database: DuckDB v0.9.3-dev3731 [kirill@Darwin 23.2.0:R 4.3.2/:memory:]
#>      nd
#>   <int>
#> 1     2
#> 2     2
#> 3     2

tbl(duckdb_con, "ex_tab") |>
  select(`2nd`) |>
  show_query()
#> <SQL>
#> SELECT 2nd
#> FROM ex_tab

DBI::dbQuoteIdentifier(duckdb_con, "2nd")
#> <SQL> 2nd

Created on 2024-02-24 with reprex v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants