Skip to content

PG::AmbiguousColumn: ERROR: column reference is ambiguous #106

@AmitLamichhane2021

Description

@AmitLamichhane2021

Hi Team,
I am trying to use custom ordering via the order_by property and I am running into a "column reference is ambiguous" error. The column I am trying to order by is called created_at.
My pagination query joins to multiple tables that all have a created_at column, so that column name is ambiguous if used by itself. I get the following error when trying to paginate with a cursor:
block in tagged - PG::AmbiguousColumn: ERROR: column reference "created_at" is ambiguous
It seems like the gem isn't appending the table name to custom order_by columns, is this the case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions