Change using sqlite3 to postresql