functions marked STABLE not allowed to do INSERT

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: functions marked STABLE not allowed to do INSERT
Date: 2005-11-14 15:02:37
Message-ID: 4378A70D.8050601@wildenhain.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jaime Casanova 2005-11-14 15:09:06 Re: functions marked STABLE not allowed to do INSERT
Previous Message Tom Lane 2005-11-14 14:24:52 Re: outer joins and for update