Page MenuHomePhabricator

Bug in Semantic Drilldown when two dates are selected as filters
Open, Needs TriagePublic

Description

When two dates are selected an SQL error is generated: "Error: 1052 Column 'o_serialized' in where clause is ambiguous (127.0.0.1)". For example in the following extract:

WHERE smw_namespace = 14 AND (smw_title = 'Patients'))
AND a0.p_id = (SELECT MIN(smw_id) FROM `mw_smw_object_ids` WHERE smw_title = 'Date of birth' AND smw_namespace = 102) AND (YEAR(STR_TO_DATE(SUBSTR(o_serialized, 3, 100), '%Y/%m/%d')) = 1938 )
AND a1.p_id = (SELECT MIN(smw_id) FROM `mw_smw_object_ids` WHERE smw_title = 'Date of recovery' AND smw_namespace = 102) AND (YEAR(STR_TO_DATE(SUBSTR(o_serialized, 3, 100), '%Y/%m/%d')) = 2016 AND MONTH(STR_TO_DATE(SUBSTR(o_serialized, 3, 100), '%Y/%m/%d')) = 8 AND DAY(STR_TO_DATE(SUBSTR(o_serialized, 3, 100), '%Y/%m/%d')) = 1 )

it can be noticed that indeed the same field o_serialized is cited several times without specifying a table even if it refers to two different tables.

I have tried to fix this bug by expliciting the tables the fields refer to.