Ecto custom SQL function

You need to create that function in migration. You do not “tell” Postgres about function each time you want to use it.