-
Notifications
You must be signed in to change notification settings - Fork 173
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
Postgres: substring generates numeric arguments instead of integer #378
Comments
FYI I was trying to use this to make up rounded dates: floor_date didn't work, I tried substring(1,7)+'-01'). I ended up working around this with:
which worked in dbplyr. So while this is still an issue, it is not a blocker for me. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@dfrankow sorry, must've been in rush and I didn't read your issue fully — your initial description was fine. |
The problem is that you're using library(dbplyr)
translate_sql(substring('abcdefghijklmno', 6,7))
#> <SQL> substring('abcdefghijklmno', 6.0, 7.0)
translate_sql(substr('abcdefghijklmno', 6,7))
#> <SQL> SUBSTR('abcdefghijklmno', 6, 2) Created on 2020-09-22 by the reprex package (v0.3.0.9001) |
Thanks for the reply! I don't understand "substring is not an R function". It looks like an R function to my naive eyes (see below). Maybe you mean it's not an internal function. However, this work-around works for me. You don't have to reply. Substring docs here. Code saying it's in
|
Oh shit, you're right. I got confused again because I never use |
As you like. Thanks for the tidyverse! |
Sorry it took so longer to get this through my head! |
Thanks! I don't want you to do more work, but just so I remember: The "last" param for |
Brief description of the problem:
It looks like there was a fix here, but almost two years later, I don't seem to have it. I don't know which version the fix went into.
Maybe I have an old version?
I tried dbplyr from the vanilla tidyverse install (1.3.0), then I also tried installing dbplyr from github:
In both cases it looks like the numbers become float (numeric), and that makes Postgres (11) cranky in some other code I have:
The text was updated successfully, but these errors were encountered: