3 ms·
> And it just so happens that all local accounts in a Mastodon instance have a null value in their URI field, so they all matched. How? NULL = NULL evaluates t
by chx 3y ago
> And it just so happens that all local accounts in a Mastodon instance have a null value in their URI field, so they all matched.
How? NULL = NULL evaluates to FALSE, SQL is a three value logic, specifically Kleene's weak three-valued logic, NULL anyoperator NULL is NULL.
- porridgeraisin 3y agoYeah, was wondering. Maybe they filter at the application level? And check equality with their language's null value?
- nateb2022 3y agoThis is the case, more or less. The fix for this issue boiled down to a one-liner: https://github.com/mastodon/mastodon/commit/13ec425b721c959415921046d7a24ed8c9994cee#diff-0bc8e960429e6c65ff6b5f31c40c67ed4cab1904dcf2dcb9f13d1503338c84ef https://github.com/mastodon/mastodon/commit/13ec425b721c9594... But basically, some object attributes (which should have been set by default) weren't set by default. This is a common oversight when dealing with data structures that are incomplete at one point or another, and it's easy to assume during programming that code will execute in a fixed order that allows for the necessary fields to be present when needed although sometimes it doesn't always work out that way. In my opinion, they were lucky to have caught this but a fix should include more than adding missing initialization. They should implement a sanity check to ensure that fields used are present and !NULL, and if things are undefined or missing for whatever reason, abort whatever process they are attempting to perform and log the issue.