Repository navigation
fix: Keep names in default dbQuoteString() and dbQuoteLiteral() methods - #799
Conversation
…ethods The default methods now keep the names of atomic input, as `dbQuoteIdentifier()` and the list (blob) branch of `dbQuoteLiteral()` already did. The generated SQL text is unchanged. Closes #786. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3s7NRVkLyg3an422b
Resolved: Run a reverse dependency check before merging?The PR was merged on 2026-11-29 without a dedicated revdep check; the release checklist's revdep run covers it. This PR changes only the names of the objects that the default
If nobody decides, the PR waits as a draft until its review is through, and no revdep run is started. Generated by Claude Code |
Accepted limitationsThe clean review found nothing above Low. For each limitation it did find, the reviewer's assessment of relevance and confidence is given at the end of the item.
Generated by Claude Code |
The default
dbQuoteString()method now passesnames(x)toSQL(), whichpaste()had dropped. The defaultdbQuoteLiteral()method keeps names in every branch: numeric and logical input (the names were lost byas.character()andas.numeric()beforeSQL(x, names = names(x))read them), and factor, Date, POSIXt and difftime input, whose conversion to character is wrapped in a smallkeep_names()helper before the value is handed todbQuoteString(). Character input goes throughdbQuoteString()as before. NaN is still quoted asNaN, because the NA check still runs on the character result. Tests intests/testthat/test-quoting.Rcover every branch, unnamed input, and check thatsqlInterpolate()andsqlAppendTable()produce the same SQL text for named input.Closes #786.
DBItest spec. The specification DBI inherits (
@inherit DBItest::spec_sql_quote_string/spec_sql_quote_literal, DBItest 1.9.0) says nothing about names for strings or literals. The return value is only required to be "an object that can be coerced to [character], of the same length as the input", and the tests compare withunname()(expect_identical(unlist(unname(x_out)), x)andexpect_equal(as.list(unname(x_out)), x)). Onlyspec_sql_quote_identifierhas a rule: "The names of the input argument are preserved in the output." This PR brings the two defaults in line with that rule for identifiers; extending the spec to strings and literals would be a separate DBItest change.Downstream impact
Small. Only the default methods change, and only for named input; unnamed input produces identical objects. A clean review compared about 25 inputs between
mainand this branch and found the SQL text byte-identical for all of them.paste()/paste0(),as.character(),vapply(..., character(1))and theshow()method (which prints[email protected]) ignore names, sosqlInterpolate(),sqlAppendTable()and printing ofSQLobjects are unchanged.sqlData()runs on data frame columns, anddata.frame()strips names from its columns, so its output is unchanged in the common case. What does change isnames()of the result, and with itformat(),c()andexpect_identical()/snapshot comparisons of quoted named vectors. dbplyr 2.6.0 does not calldbQuoteString()ordbQuoteLiteral()(itsescape()quotes with its ownsql_quote()), so its translations are not affected. Backends that implement their owndbQuoteString()keep their own behavior; the defaultdbQuoteLiteral()now hands them named character input for factor, date and time values. A light code search found no downstream tests that compare quoted named vectors, but a reverse dependency check was not run.Open question: revdep check, #799 (comment)
Accepted limitations: #799 (comment)
https://claude.ai/code/session_01Hr1rd3s7NRVkLyg3an422b
Generated by Claude Code