Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> On Tue, 2010-07-20 at 11:31 +0200, Pavel Stehule wrote:
>> I am working on to_array, to_string functions and I am looking on
>> string_to_array function. I am surprised so this function is marked as
> What's wrong with that? "current_date" is the part that's changing, and
> it's being passed as an argument to the function. If the argument
> changes, an immutable function can return a different result.
string_to_array() seems fine to me: it's a predictable transformation
from text to text. However, I think that there really is an issue with
array_to_string(), because that takes an anyarray and invokes the array
element's type output function. Type output functions are not
necessarily immutable, and if the input is of a type where that's not
true, then the array_to_string() transformation isn't immutable either.
An example is that date's output function produces different results
depending on datestyle.
I can't remember offhand whether there are any volatile type output
functions, but if there were we'd really need to mark array_to_string()
as volatile. That would be unpleasant for performance though. I'd
rather compromise on stable. Thoughts?
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Jeff Davis||Date: 2010-07-29 00:51:09|
|Subject: Re: string_to_array has to be stable?|
|Previous:||From: Tom Lane||Date: 2010-07-28 23:36:05|
|Subject: Re: do we need to postpone beta4? |