Replace sqlite3 with pg