changing to pg from sqlite3