fix property filters to work with Postgres
This should be DB-agnostic and also works with Postgres now.
@rafalcymerys
Hi @mrbrdo - what was the problem with postgres here? I have my intuition, but would like to confirm if I'm reading it correctly ;)
@rafalcymerys I think the problem was that the scope coming in has an order, and postgres needs you to order first by the columns you are selecting DISTINCT. therefore the query failed as the ORDER BY is by something other than what we are pluck-ing. In any case it surely had to do with the ORDER BY part which Postgres didn't like in some combination of incoming scope. Either due to distinct query or group by or something like that.
That makes sense. Was that an issue coming out of your customization (where the scope coming in had the order set) or an issue in core spree?
@rafalcymerys hard to remember after 6 months. I don't think I did any changes to properties, so I'd guess it was related to spree core. I have some vague recollection that in one case the scope coming in depended on selected filter/sort value, and only under a certain condition would it cause issues, I think it was when doing a search (Ransack). If I was providing said scope I would fix that code rather than spree core which I try to avoid when possible.
