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

PostgreSQL Errors in 3.2.3 vs. 3.1.1 #544

Closed
vanboom opened this issue May 20, 2014 · 14 comments
Closed

PostgreSQL Errors in 3.2.3 vs. 3.1.1 #544

vanboom opened this issue May 20, 2014 · 14 comments
Assignees
Labels
Milestone

Comments

@vanboom
Copy link

vanboom commented May 20, 2014

Hi,
I am not able to upgrade my Rails 4.0.2 app to acts-as-taggable-on 3.2.3.

@clients = Client.where(:active=>true).tagged_with(@tag.name,:order=>'lname asc')
@not_clients = Client.where(:active=>true).tagged_with(@tag.name,:exclude=>true,:order=>'lname asc')

Statements like these are causing PostgreSQL errors stating that the field used in ORDER or GROUP BY must appear in the SELECT list.

This is not happening for 3.1.1. Thanks for an amazing gem - please advise.

@Skulli
Copy link

Skulli commented May 23, 2014

Having the same problem here on rails 3.2.18.
The statement tagged_with does a GROUP BY now, which did not happen in the previous versions.

@seuros seuros added the bug label May 23, 2014
@seuros seuros added this to the 3.3.0 milestone May 23, 2014
@seuros seuros self-assigned this May 23, 2014
@seuros
Copy link
Collaborator

seuros commented May 23, 2014

Ok, i will try to fix this one too, today.

@seuros
Copy link
Collaborator

seuros commented May 23, 2014

@Skulli , @vanboom , can you provide a test case ?
I can't reproduce this error.

@Skulli
Copy link

Skulli commented May 24, 2014

Document.tagged_with("Test", :any => true, :wild => true)

This generates a GROUP BY in the statement, which did not happen in the previous version.
The statement alone gives a correct result but i am merging it with another scope.

With the above call as scope doc_scope i have a query like

AnotherModel.joins(:document).merge(doc_scope).except(:select)

The except is important, otherwise it would call

SELECT documents.*

instead of

SELECT another_model.*

@seuros
Copy link
Collaborator

seuros commented May 24, 2014

Ok, i will give it a try again. Thank you for your reply

@seuros
Copy link
Collaborator

seuros commented May 24, 2014

@Skulli , @vanboom can you try 3c9b170 ?

I can't remove the group by since it resolve an issue with duplicate tags.

In 3.1.1, tables with json,hstore columns were throwing an error when we used DISTINCT.

I tried to fix it without breaking any tests. The one side effect with group by is that .count return a hash instead of integer.

Let me know if that work for you so i can merge this to master and release v 3.2.4

@Skulli
Copy link

Skulli commented May 24, 2014

Stupid question maybe, but how do i check that commit out?

gem 'acts-as-taggable-on', :git => "https://github.com/mbleigh/acts-as-taggable-on.git", :ref => "3c9b170667477fb854f95a1d89867e3fd64622ef"

did not work for me, commit/ref isnt known.

@seuros
Copy link
Collaborator

seuros commented May 24, 2014

@Skulli that correct, i just found a bug in the new code. I will update you once i push the changes.

seuros added a commit to seuros/acts-as-taggable-on that referenced this issue May 24, 2014
@seuros
Copy link
Collaborator

seuros commented May 24, 2014

@Skulli :
gem 'acts-as-taggable-on', :git => "https://github.com/seuros/acts-as-taggable-on.git", branch: 'taglistparser'
You will be able to use the rubygem version or master branch once this ticket is closed by the merge.

you will have to use 'Document.tagged_with("Test", any: 'distinct', wild: true)' .

@Skulli
Copy link

Skulli commented May 24, 2014

branch isnt pushed to origin yet, cant fetch it

@seuros
Copy link
Collaborator

seuros commented May 24, 2014

Note that it my fork and not this one.
https://github.com/seuros/acts-as-taggable-on/tree/taglistparser

@Skulli
Copy link

Skulli commented May 24, 2014

Sorry my bad.

Seems to work now, not getting errors anymore and results are correct.

@seuros seuros closed this as completed in 260ed3e May 24, 2014
seuros added a commit that referenced this issue May 24, 2014
Deprecated Taglist.parse and fix #544
@seuros
Copy link
Collaborator

seuros commented May 24, 2014

You can use master now.

@seuros
Copy link
Collaborator

seuros commented May 24, 2014

And now from rubygems.

tekniklr pushed a commit to tekniklr/acts-as-taggable-on that referenced this issue Mar 19, 2021
tekniklr pushed a commit to tekniklr/acts-as-taggable-on that referenced this issue Mar 19, 2021
tekniklr pushed a commit to tekniklr/acts-as-taggable-on that referenced this issue Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants