Versioning approach for PostgreSQL using PL/pgSQL functions