Fixed sqlite and pg problem