Fix sql compile on some platforms