ActiveRecord::StatementInvalid (PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list)
LINE 1: ...ble_type" = $2 / loading for inspect / ORDER BY "spree_rel
SQL generated:
Spree::Product.last.relation_types.to_sql
SELECT DISTINCT "spree_relation_types".*
FROM "spree_relation_types"
INNER JOIN "spree_relations" ON "spree_relation_types"."id" = "spree_relations"."relation_type_id"
WHERE "spree_relations"."relatable_id" = 14 AND "spree_relations"."relatable_type" = 'Spree::Product'
ORDER BY "spree_relations"."position" ASC
product_relation_types method in the following view
cause the following errors
ActiveRecord::StatementInvalid (PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list) LINE 1: ...ble_type" = $2 / loading for inspect / ORDER BY "spree_rel
SQL generated:
The similar error has been raised here:
https://stackoverflow.com/questions/9795660/postgresql-distinct-on-with-different-order-by.
Is there anyone having this issue?
Tested with the following env:
I tried to fix this with by resetting the order by clause:
Any comments on this?