KFSUPGRADE-998 fix sql