Details
-
Bug
-
Resolution: Fixed
-
High
-
2.0.4
Description
The SQL upgrade task produces incorrect results for sql/HSQL/upgrade/upgrade_36.sql and so all reviews will look like they were created by the first user.
The bug is in the following:
insert into new_cru_state_change (select cru_id, cru_time_stamp, cru_superseded, cru_review_id,cru_new_state, (SELECT p.cru_user FROM cru_review_participant p WHERE cru_review_id = p.cru_review_id AND p.cru_moderator = true limit 1) from cru_state_change);
The nested query seems to be joining on itself cru_review_id = p.cru_review_id.
Changing the statement to the following fixes it:
insert into new_cru_state_change (select cru_id, cru_time_stamp, cru_superseded, cru_review_id,cru_new_state, (SELECT p.cru_user FROM cru_review_participant p WHERE cs.cru_review_id = p.cru_review_id AND p.cru_moderator = true limit 1) from cru_state_change cs);