Default way of translating n() to sql code should be count(*) and not count() #343
Labels
bug
an unexpected problem or unintended behavior
func trans 🌍
Translation of individual functions to SQL
Milestone
Problem is described in the closed issue 314 .
Particularly obvious if one tries to use e.g. the corrr:::correlate() function, where obviously n() is needed to calculate the number of rows. The error message provided says that the count function requires 1 argument but 0 are provided. I tested the count() vs. count(*) on sqlfiddle and the version without * did not work for any of the possible examples, including versions of PostgreSQL, MySQL, Oracle, SQLite. I actually do not know a single sql language where this meight work (although I am not very experienced tbh).
Workaround is described by @hadley here but I think changing the translation to count(*) is the proper way of dealing with this.
The text was updated successfully, but these errors were encountered: