Commented out Gustaf's broken version of db_nextval, and replaced it with the slower, but *correct*, earlier version. The "improved" version can be commented back in locally for those who don't care about correctness. Or it can be corrected and put back in if someone cares to fix it.