Final version for PostgreSQL tables