#3966 fixed and tested postgres,oracle,mysql