I'm using dbplyr with redshift. The explain function fails with an error but works if I comment out a line in backend-postgres.R.
I construct a dplyr expression named (e.g.) dbquery and then explain(dbquery). The sql translation is printed but the plan is not. I consistently get the following error:
<PLAN>
Error: Failed to prepare query: ERROR:
LINE 1: EXPLAIN (FORMAT text) SELECT *
^
syntax error at or near "FORMAT"
The function backend-postgres.R contains this code
build_sql(
"EXPLAIN ",
(!is.null(format)) sql(paste0("(FORMAT ", format, ") ")),
sql,
con = con
)
If I comment out the line beginning (!is.null, the explain function works.
I apologize for not offering a reprex, but I don't have access to a public redshift database.