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

fix: column id can be ambiguous in group filter with extensions #3696

Merged
merged 2 commits into from
Nov 27, 2022
Merged

fix: column id can be ambiguous in group filter with extensions #3696

merged 2 commits into from
Nov 27, 2022

Conversation

iPurpl3x
Copy link
Contributor

Changes proposed in this pull request:
Changed 'id' to 'groups.id' to avoid Column 'id' in where clause is ambiguous error.

This error normally doesn't occur, but if an extension adds an id column to the group_user table, then this error would occur.

(Adding that column helps when one wants to chunkById() on the group_user model)

Reviewers should focus on:
Nothing is broken by this minor change.

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

@iPurpl3x iPurpl3x requested a review from a team as a code owner November 24, 2022 14:07
@SychO9
Copy link
Member

SychO9 commented Nov 24, 2022

You made a typo, it's groups.id

@iPurpl3x
Copy link
Contributor Author

Good catch @SychO9! I fixed it.

@imorland imorland added this to the 1.7 milestone Nov 25, 2022
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the long term, we should look into prefixing all columns with table names in filters/gambits to avoid these issues.

@SychO9 SychO9 changed the title Avoid error: Column 'id' in where clause is ambiguous fix: column id can be ambiguous in group filter with extensions Nov 27, 2022
@SychO9 SychO9 merged commit 605225c into flarum:main Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants