Fortuna library functions extracted from PostgreSQL source