r/adbcsqlite: Issue with identifier quoting (may need support for backtick quoting)
- Dominant language
- C#
- Stars
- 627
- Forks
- 217
- Avg merge
- 17h
- Merged PRs (30d)
- 57
Description
With the current quoting infrastructure I get
```r
library(adbcdrivermanager)
db <- adbc_database_init(adbcsqlite::adbcsqlite(), uri = ":memory:")
con <- adbc_connection_init(db)
query <- paste0(
"SELECT ", adbc_connection_quote_identifier(con, "b"), " FROM (",
"SELECT 1 AS ", adbc_connection_quote_identifier(con, "a"), ")"
)
query
#> [1] "SELECT \"b\" FROM (SELECT 1 AS \"a\")"
```
Which is then evaluated without error to
```r
stmt <- adbc_statement_init(con)
adbc_statement_set_sql_query(stmt, query)
res <- nanoarrow::nanoarrow_allocate_array_stream()
adbc_statement_execute_query(stmt, res)
as.data.frame(res)
#> "b"
#> 1 b
```
From RQSLite I get
```r
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
query <- paste0(
"SELECT ", DBI::dbQuoteIdentifier(con, "b"), " FROM (",
"SELECT 1 AS ", DBI::dbQuoteIdentifier(con, "a"), ")"
)
query
#> [1] "SELECT `b` FROM (SELECT 1 AS `a`)"
```
Which then throws the expected error as
```r
DBI::dbGetQuery(con, query)
#> Error: no such column: b
```
Contributor guide
Assessment
This issue has not been assessed yet.