Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

PG Errorcolumn - "trigrams.owner_type" must appear in the GROUP BY clause #3

Closed
abrambailey opened this issue May 1, 2013 · 2 comments

Comments

@abrambailey
Copy link

Everything seemed to work as planned until I actually ran:

 Business.find_by_fuzzy_name('Bay')

...and received:

Trigram Load (1.6ms)  SELECT owner_id, owner_type, count(*) AS matches, score FROM "trigrams" WHERE "trigrams"."owner_type" = 'Business' AND "trigrams"."fuzzy_field" = 'name' AND "trigrams"."trigram" IN ('**b', '*ba', 'bay', 'ay*') GROUP BY "trigrams"."owner_id" ORDER BY matches DESC, score ASC LIMIT 10
ActiveRecord::StatementInvalid: PG::Error: ERROR:  column "trigrams.owner_type" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT  owner_id, owner_type, count(*) AS matches, score FRO...
@mezis
Copy link
Owner

mezis commented May 2, 2013

That should be an easy fix (I'm running MySQL mostly, so missed it). I'll propose something, will poke you when ready.

@abrambailey
Copy link
Author

Cool thanks.

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