Re: Function Volatility Stable vs Immutable

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Igal (at) Lucee(dot)org" <igal(at)lucee(dot)org>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Function Volatility Stable vs Immutable
Date: 2019-06-25 02:38:33
Message-ID: CAKFQuwZ1JF7+cS2O5ZpepQrJavMAsRr5cUfW3wYQHEpeEddjLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jun 24, 2019 at 7:31 PM Igal @ Lucee.org <igal(at)lucee(dot)org> wrote:

> If a function select data from a table, and the rows in the table may
> change, would that function qualify for Immutable or does it have to be
> Stable? I'm asking because according to the docs [1]: "An IMMUTABLE
> function cannot modify the database and is guaranteed to return the same
> results given the same arguments forever".
>
> So for the same arguments, the result would change only if the data in
> the table changes. Does that mean that it violates the "forever" clause
> and therefore can be only marked as Stable and not Immutable?
>

Yes

Forever means beyond the lifetime of a single transaction and thus it is
possible for the changing of the table contents to impact the return value
of the function.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igal @ Lucee.org 2019-06-25 02:54:27 Re: Function Volatility Stable vs Immutable
Previous Message Igal @ Lucee.org 2019-06-25 02:31:27 Function Volatility Stable vs Immutable