functions marked STABLE not allowed to do INSERT - Mailing list pgsql-hackers

From Tino Wildenhain
Subject functions marked STABLE not allowed to do INSERT
Date
Msg-id 4378A70D.8050601@wildenhain.de
Whole thread Raw
Responses Re: functions marked STABLE not allowed to do INSERT
Re: functions marked STABLE not allowed to do INSERT
List pgsql-hackers
New in 8.1 it seems functions marked STABLE are
not allowed to have any INSERT statement in them.

However in this particular case, the insert does not
violate the rule:

"STABLE indicates that within a single table scan the function will 
consistently return the same result for the same argument values, but 
that its result could change across SQL statements."

it does basically lookup a value by a foreign key
and builds a surrogate key on demand.

I know I could make it volatile but otoh I really want
the optimizer to optimize calls away as possible.

Now, what to do beside a private revert to the
patch?

Regards
Tino


pgsql-hackers by date:

Previous
From: rasmusra@gmail.com
Date:
Subject: Re: PostgreSQL roadmap for 8.2 and beyond.
Next
From: Jaime Casanova
Date:
Subject: Re: functions marked STABLE not allowed to do INSERT