-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
using "tagged_with" with .uniq or .select(distinct(...) throws DISTINCT error #357
Comments
Confirm this! |
I can confirm that - it happens when you add { any: true } option. I do believe this is because of the string in core.rb: select_clause = "DISTINCT #{table_name}.*" unless context and tag_types.one? and if you make a complex request all this select query added to other part of your request as is. Tested it in 3.0.1 and 2.4.2 My solution: #461 |
The merged commit seems to call
Using this commit, every call to Model.tagged_with will raise this error. Before it would only raise the error when using |
Any tests to reproduce the bug ? |
Here is a test to reproduce. I'll see about creating a new bug.
|
Take a look under https://gist.github.com/casheghian/e1b7fd206d6434f4972b to see the search method I am using.
When using the commented out line everything works great, however I am left with duplicate results.
Using the current join and select statement or .uniq on what returns throws a
"PG::Error: ERROR: syntax error at or near "DISTINCT"
LINE 1: SELECT distinct(restaurants.id), restaurants.*, DISTINCT res.."
The text was updated successfully, but these errors were encountered: