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

Columns in $searchable are ambiguous #8

Open
ghost opened this issue Mar 1, 2022 · 0 comments
Open

Columns in $searchable are ambiguous #8

ghost opened this issue Mar 1, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 1, 2022

Your issue may already be reported!
Please search on the issue tracker before creating one.

Expected Behavior

It should be possible to use the same column name on a joined table without SQL errors

Current Behavior

If a column name specified in the $searchable array also exists in a joined table (e.g. in another scope), a SQL error occurs because the column name is ambiguous

Possible Solution

When using any column in the $searchable array, it should be prefixed with the table name associated with the repository

Steps to Reproduce (for bugs)

  1. Add parent_id to the $searchable array
  2. Add a custom scope which joins to another table and uses parent_id in that table
  3. Code fails with an ambiguous column

Context

We have generic names on several tables so we have had to work around this by removing any clashing names from the $searchable array and adding custom scopes to search on that field, thus defeating the point of the array.

Your Environment

  • Version used: 1.8
  • Browser Name and version: N/A
  • Operating System and version (desktop or mobile): N/A but Ubuntu
  • Link to your project: Private project

System GA

Analytics

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

0 participants