Peter Eisentraut <peter_e@gmx.net> writes:
> On Tue, 2009-10-20 at 20:48 -0400, Tom Lane wrote:
>> So I went to see about making the changes to remove regex_flavor, and
>> was astonished to find that all the regex-related functions are already
>> marked immutable, and AFAICS always have been. This is clearly wrong,
>> and we would have to fix it if we weren't about to remove the GUC.
> Are you sure this wasn't intentional, because it breaks performance and
> we doubted that many applications would change regex_flavor on the fly?
Intentional or not, it's wrong :-(
In practice I doubt there are many cases where constant-folding a regex
would be possible or performance-critical. The real use of having it
be immutable is probably Rod's, ie, using it in an index. And that is
*obviously* really dangerous if there's a GUC affecting the results.
regards, tom lane