Full text search with Left Outer Join causes fields to be null
Description
Using a full text search with left outer join can cause some fields to be null when they should not. Note this only occurs if the item on the outer join is null and appears in the query result. Please see the following example.
If an a row returns with a company the fields are populated but if the company is null then lastName is null. The field that is nullified seems to be relative to where ever a company field is placed. Note, ff the full text search is removed from the where expression the data comes back as expected.
From my investigation it looks like the missingColumns bitmask from here is incorrect. This is also an issue in the iOS sdk, the only difference is that nil is used instead of null.
We have tried moving the fields coming from the outer join to the bottom of the select expression with some success but this doesn't work as soon as you do more than one left outer join.
Explain:
SELECT fl_result(fl_value("company".body, 'name')), fl_result(fl_value("person".body, 'firstName')), fl_result(fl_value("person".body, 'lastName')), fl_result(fl_value("person".body, 'gender')) FROM kv_default AS "person" LEFT OUTER JOIN kv_default AS "company" ON (fl_value("person".body, 'companyID') = fl_value("company".body, 'id')) AND ("company".flags & 1 = 0) WHERE ( fl_value("person".body, 'type') = 'Person') AND ("person".flags & 1 = 0)
3|0|0| SCAN TABLE kv_default AS person 11|0|0| SCAN TABLE kv_default AS company
Using a full text search with left outer join can cause some fields to be null when they should not. Note this only occurs if the item on the outer join is null and appears in the query result. Please see the following example.
If an a row returns with a company the fields are populated but if the company is null then lastName is null. The field that is nullified seems to be relative to where ever a company field is placed. Note, ff the full text search is removed from the where expression the data comes back as expected.
From my investigation it looks like the missingColumns bitmask from here is incorrect. This is also an issue in the iOS sdk, the only difference is that nil is used instead of null.
We have tried moving the fields coming from the outer join to the bottom of the select expression with some success but this doesn't work as soon as you do more than one left outer join.
Explain: