You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The number argument passed to addDaysQuery and minusDaysQuery is treated by dbplyr parser as double/numeric.
As a result for Redshift driver we get DATEADD(DAY, <double>, "variable") statement.
Such statement produces error as DATEADD is not supporting doubles as a second argument for Redshift.
To Reproduce
# unfortunately the needs an active Redshift connection in order to reproducedb<-DBI::dbConnect(
RPostgres::Redshift(),
dbname= Sys.getenv("REDSHIFT_DBNAME"),
host= Sys.getenv("REDSHIFT_HOST"),
port= Sys.getenv("REDSHIFT_PORT"),
user= Sys.getenv("REDSHIFT_USERNAME"),
password= Sys.getenv("REDSHIFT_PASSWORD")
)
cdm<-CDMConnector::cdmFromCon(
con=db,
cdmSchema= c(schema= Sys.getenv("CDM_SCHEMA")),
writeSchema= c(schema= Sys.getenv("CDM_WRITE_SCHEMA"), prefix="test"),
cdmName= Sys.getenv("REDSHIFT_DBNAME")
)
query_expr<-IncidencePrevalence:::addDaysQuery(cdm, "index_date", 1, "day", "expr")
my_tbl<-dplyr::tbl(db, "mytbl")
inc_date_tbl<-my_tbl|>dplyr::mutate(inc_date=!!query_expr$expr)
inc_date_tbl|>dplyr::show_query()
#> <SQL>#> SELECT "mytbl".*, DATEADD(DAY, 1.0, "index_date") AS "inc_date"#> FROM "mytbl"inc_date_tbl|>dplyr::collect()
#> Error in `dplyr::collect()`:#> ! Failed to collect lazy table.#> Caused by error:#> ! Failed to prepare query: ERROR: function pg_catalog.date_add("unknown", numeric, date) does not exist#> HINT: No function matches the given name and argument types. You may need to add explicit type casts.
Desktop (please complete the following information):
Describe the bug
The
number
argument passed toaddDaysQuery
andminusDaysQuery
is treated by dbplyr parser as double/numeric.As a result for Redshift driver we get
DATEADD(DAY, <double>, "variable")
statement.Such statement produces error as DATEADD is not supporting doubles as a second argument for Redshift.
To Reproduce
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: