Significant is that function get_bug_id() being STABLE is necessary for the bug to occur. It appears to be not a bug, since documentation reads:
> For functions written in SQL or in any of the standard procedural > languages, there is a second important property determined by the > volatility category, * > namely the visibility of any data changes that have been made by the SQL > command that is calling the function. A VOLATILE function will see such > changes, a STABLE or IMMUTABLE function will not
I don't think this is relevant, since the changes were NOT made by the SQL command calling the function. They were made by the INSERT which executed earlier in a VOLATILE function.