I have read the documentation couple of times and I still can not figure out the following aspects.
if a function does insert/update/delete it needs to be stable or volatile ? if a immutable function executes 'nextval' should itself be also volatile ?