Skip to content

Distinct select bug when sorting on joined record #42

@calebfaruki

Description

@calebfaruki
irb(main):022:0> Requirement.filter(params['where']).sort(customer: {name: {asc: :nulls_last}}).distinct_on(:id)
Traceback (most recent call last):
ActiveRecord::StatementInvalid (PG::InvalidColumnReference: ERROR:  SELECT DISTINCT ON expressions must match initial ORDER BY expressions)
LINE 1: SELECT DISTINCT ON ( "requirements"."id" ) "requirements".* ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions