[mr2691] Fix some SQL errors after mr2656 .