PostgreSQL extract function.