Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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