-
Notifications
You must be signed in to change notification settings - Fork 11
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
SQL: fix function definition of ticket_dependee_missing #200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the patch fixes the issue, but somehow I feel it would be more obvious to have "tbl_ticket dependee" as the FROM clause (and all the joins in reverse order), since dependee is used in SELECT, not depender (which is the now the FROM clause). If I'm not mistaken this should result in fewer LEFT JOINS, or am I missing something?
Interesting suggesstion... I'll try to refactor the function and EXPLAIN it. |
Maybe you missed that "ep" and "epv" are also SELECTed, even before "tbl_ticket dependee" (of course this is only the view of an imperative programmer with the concept of lazy evaluation in mind and doesn't actually apply here). For me it was more obvious to "crawl" from the given depending ticket to the unknown dependee ticket. Another approach to get rid of all those JOINS (in multiple places) would be to keep track of the dependee via a dedicated column in tbl_ticket. It is seldomly changed but read extremely often (view_servicable_tickets etc.) |
If we do that we should combine the effort with other planed cached values and columns, see #167. |
219d2c5
to
b25072d
Compare
Of course, but the intention of this PR was bugfixing. |
src/Application/Migrations/18_function_ticket_dependency_missing.sql
Outdated
Show resolved
Hide resolved
b25072d
to
a7fe54a
Compare
Turns out, the actual bugfix comes from not returning null, but changing the default return value to true was indeed wrong. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fine
SQL: fix function definition of ticket_dependee_missing, fixes #199