Tried to make table generation work for postgres too