Skip to content

explain() plan fails with redshift database but works if a line in backend-postgres.R is removed #740

@rmcd1024

Description

@rmcd1024

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions