Question on handling of Date
with glue_sql()
#98
Labels
bug
an unexpected problem or unintended behavior
Date
with glue_sql()
#98
Hi there! I love
glue_sql()
for safe interpolation, but have a question regarding how it (andDBI
underneath) handleDate
objects.I use SQL Server 2016.
I have a query that drops rows when a refresh is required. Something like this:
Created on 2018-07-19 by the reprex package (v0.2.0).
As you can see, the Date is returned without quotes. Is this ever useful? I don't know a ton about every other flavor of SQL, but I don't know of any that can use unquoted dates.
Regarding
DBI
, I was going to suggest that you could usedbQuoteLiteral()
rather thandbQuoteString()
inglue:::sql_quote_transformer()
, but it seems to try and print the time zone forDate
objects when it coerces them to character. This doesn't work with SQL Server, and I'm not sure where it would apply.Is the best solution just to coerce to character first, then run
glue_sql()
? Or is it worth looking into further? Thanks!The text was updated successfully, but these errors were encountered: