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

disambiguate columns used in query ordering #1893

Merged
merged 1 commit into from
Oct 5, 2020

Conversation

robbkidd
Copy link
Contributor

@robbkidd robbkidd commented Oct 4, 2020

Description

Queries using the named ordering options and also joins with other tables were failing with:

ActionView::Template::Error: PG::AmbiguousColumn:
ERROR:  column reference "id" is ambiguous
LINE 1: SELECT DISTINCT cookbook_followers_count, id AS alias_0, "c…

Database query was traced to these ordering options in the Cookbook scopes.

Added tests for the API route and query parameters that triggered these errors. Added tablenames to the column references to pass the tests.

Related Issue

Fixes #1892

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

Queries using the named ordering options and also joins with other
tables were failing with:

  ActionView::Template::Error: PG::AmbiguousColumn:
  ERROR:  column reference "id" is ambiguous
  LINE 1: SELECT DISTINCT cookbook_followers_count, id AS alias_0, "c…
                                                    ^

Database query was traced to these ordering options in the Cookbook
scopes.

Added tests for the API route and query parameters that triggered these
errors. Added tablenames to the column references to pass the tests.

Signed-off-by: Robb Kidd <rkidd@chef.io>
@robbkidd robbkidd force-pushed the robb/disambiguate-columns-in-query-order branch from 6c55d37 to c8860ac Compare October 4, 2020 17:44
Copy link

@davymcaleer davymcaleer left a comment

Choose a reason for hiding this comment

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

👍

@robbkidd robbkidd merged commit b7f50ff into master Oct 5, 2020
@robbkidd robbkidd deleted the robb/disambiguate-columns-in-query-order branch October 5, 2020 15:16
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

Successfully merging this pull request may close these issues.

Cookbook API calls with user and order parameters results in error
2 participants