Pg friendly

These changes can help make PearlBee ready for other backends, specifically PostgreSQL.