https://www.postgresqltutorial.com/postgresql-create-function/