-
Notifications
You must be signed in to change notification settings - Fork 503
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
Self-Relation Column and "select" #33
Comments
Hey @demogar thanks for posting this issue. I actually have never tested it with self-relation columns. I definitely will now, though! I'm going to see if I can't find some time later tonight to test out your issue and come up with a fix. |
I think I understand the problem: the used SQL request is the following one: SELECT DISTINCT categories.id, categories.*, (SELECT name FROM categories WHERE categories.parent_id = categories.id) AS parent_category FROM As here the local and foreign table is the same, the where clause is 'categories.parent_id' = 'categories.id'... Of course never found. A correction could be to always force the use of an alias (This request works): SELECT DISTINCT categories.id, categories.*, (SELECT name FROM categories AS foreign_table WHERE categories.parent_id = foreign_table.id) AS parent_category FROM |
Ah ha! Good catch, @gilr! You saved me a bunch of time. I'm going to try to come up with a good solution to this issue. Will let you guys know soon! |
Thanks a lot for all feedback guys. I will try to come up with a solution (if I find how this query is constructed 😄). I'm looking forward to hearing back about this issue. Thanks. |
Hey guys I just pushed this commit: For some reason it isn't attaching to this issue, but that commit should solve this problem. Along the way, I also added a nice feature where Administrator recognizes if something is a self-relationship, and as such will update the filter/edit options for that relationship after you save or delete an item. So your self-relationship will always stay up to date with the latest options. Let me know if you guys find any issues! |
Morning.
I just tried to create a self-related column (Category) like so:
and the column is blank. Model looks like the following:
Am I missing something?
The text was updated successfully, but these errors were encountered: