Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AmitLamichhane2021 opened this issue Jan 9, 2023 · 1 comment
Open

Comments

@AmitLamichhane2021
Copy link

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?

@modosc
Copy link

modosc commented Oct 27, 2023

it looks like a fork has a fix for this: frollous@efc9a15#diff-c201f4d60dd83e98535d880e8d9b9ad479792383bb84e0cddd4a9122514e11b5

i'm testing it now in our application. i tried making a pr with this change + specs but i cannot get the specs running locally on my machine (the combination of ruby 3.0.6 + mysql2 won't build on my mac?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants