Skip to content

last / first / nth not working with PostgreSQL #531

@florianWickler

Description

@florianWickler

Please have a look at
http://stackoverflow.com/questions/25184965/r-dplyr-how-to-use-last-first-nth-correct-in-a-sql-database

 library("dplyr")
 mytab <- tbl(src_postgres(dbname, host, port, user, password), "catalog")
 mytab <- group_by(mytab, catalog_id)
 mytab<- mutate(mytab, curr2 = last(currency))
 mytab

RS-DBI driver: (could not Retrieve the result : ERROR: function first_value() does not exist

mytab$query

SELECT "catalog_id", "currency", "skonto", FIRST_VALUE() OVER (PARTITION BY "catalog_id") AS "curr2" FROM "catalog"

In my opinion the query should be:

SELECT "catalog_id", "currency", "skonto", FIRST_VALUE(currency) OVER (PARTITION BY "catalog_id") AS "curr2" FROM "catalog"

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions