The Postgres SQL routines needed for the XMM-Newton reduction