-
-
Notifications
You must be signed in to change notification settings - Fork 859
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
[Bug] Error when searching self join relationships. #880
Comments
@coolflames can you try returning the query if it works? I think I've seen this issue before and this might be related to self join handling of the DB driver. return $menuss = Appl_menu::with('modules', 'menus')->get(); If this works, then there must be a bug in the package when compiling self join tables. Thanks for reporting. |
the query work well the first time populate data, problems appear when it starts input search |
Hello, i think i have the same issue on a n.n relation. i have a count columns that works on init but when searching the query string is interpreted as a column name in the like clause, and it end up with a sql error. I don't want that column to be searchable anyway, the searchable parameter is false when i'm doing a dump of $request->query. I don't understand why searchableColumnIndex() still return that column. i'm on 6.24.4, do i need to update laravel to 5.4 and datatables to 7.*? thanks |
I have another example of failing self joins, where email is having recovery email (one to many) and forwarding to emails (many to many). Here are the relevant parts of the Email model (relations):
Here is the failing query, where recoveryEmail is referencing email_accounts table and I'm querying base table with the same name:
And the exception + failing MySQL query:
The problem is similar with forwardingToEmails. I guess this is more of a problem with Eloquent not allowing aliasing, that's why DataTables package doesn't know how to order the data (since both tables -base and joined use the same name). Was wondering if there may be a workaround for it? |
Fixed via #2051. |
Hi, I'm using v9.4.1 but still getting the unique table error on self joining for parent relation. My datatables index method and the relation:
Thanks! |
@dhcmega the PR was reverted as it causes another issue. Self join is currently not yet supported again. Thanks! |
So any suggestion on this yet? I do not even have a self-joined table, but I have same issue. |
So do you have any plan for fix this problem? |
Any fix for this? |
Summary of problem or feature request
I have a problem when search data
Code snippet of problem
My Model
my controller
Error output when search
javascript output
What is this error and why that is occurred?
System details
The text was updated successfully, but these errors were encountered: