PostgreSQL: Port update-keys.sql to PostgreSQL