Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

row_number doesn't work for PostgreSQL #527

Closed
kismsu opened this issue Aug 5, 2014 · 2 comments
Closed

row_number doesn't work for PostgreSQL #527

kismsu opened this issue Aug 5, 2014 · 2 comments

Comments

@kismsu
Copy link

kismsu commented Aug 5, 2014

Hi, row_number() function for PostgreSQL table returns an error

Error: Must supply at least one of partition, order, frame

But I can't send any parameter to the function
Here the full example

md_dplyr<-src_postgres(host="localhost", user="postgres",
                       password="", dbname="postgres", port="5432")

data("hflights", package = "hflights")
dbRemoveTable(my_db$con,"hflights")
test <- copy_to(md_dplyr, hflights, temporary = FALSE, indexes = list(
    c("Year", "Month", "DayofMonth"), "UniqueCarrier", "TailNum"))

mutate(test, id = row_number())
@hadley
Copy link
Member

hadley commented Aug 26, 2014

Duplicate of #484

@hadley hadley closed this as completed Aug 26, 2014
@hadley
Copy link
Member

hadley commented Aug 28, 2014

Actually this error is telling you (albeit) indirectly that row_number() doesn't work with Postgres because there's no intrinsic order. Either do row_number(year) or sort the data first.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants