Is it possible to start a function (a my function) when the server postgres is started? and how I can do?
No.. There's no way that can be done in Postgres. Although you can add something to your startup scripts that connects to the DB immediately after starting it, and calls the function you need.