Skip to content

Query result with zero rows returns data.frame without columns #103

@david-cortes

Description

@david-cortes

Steps to reproduce:

  • Establish a connection to some DB
  • Run a query that would not return any rows, but which would anyway have defined columns, e.g.
con <- RPostgreSQL::dbConnect(DBI::dbDriver("PostgreSQL"), dbname = dbname,
								  host = host, port = 5432,
								  user = user, password = password)
RPostgreSQL::dbGetQuery(con, "select 'a' as col1, 'b' as col2 where false")

Expected results:
Should return a data.frame with zero rows and the column names that would be specified by the query.

Actual results:
Returns an empty data.frame with zero rows and zero columns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions