Fixed terminate connection sql for postgresql 9.2+