[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: Function Volatility Stable vs Immutable
From:       "Igal  ()  Lucee ! org" <igal () lucee ! org>
Date:       2019-06-25 2:54:27
Message-ID: fc4f4a3c-8aec-b559-a655-f76b43e7ee6a () lucee ! org
[Download RAW message or body]

On 6/24/2019 7:38 PM, David G. Johnston wrote:
> On Mon, Jun 24, 2019 at 7:31 PM Igal @ Lucee.org <igal@lucee.org 
> <mailto:igal@lucee.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.

Thanks for clarifying, David.

Igal


[Attachment #3 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 6/24/2019 7:38 PM, David G. Johnston wrote:<br>
    <blockquote type="cite"
cite="mid:CAKFQuwZ1JF7+cS2O5ZpepQrJavMAsRr5cUfW3wYQHEpeEddjLw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div class="gmail_default"
            style="font-family:arial,helvetica,sans-serif"><span
              style="font-family:Arial,Helvetica,sans-serif">On Mon, Jun
              24, 2019 at 7:31 PM Igal @ Lucee.org &lt;<a
                href="mailto:igal@lucee.org" moz-do-not-send="true">igal@lucee.org</a>&gt;
              wrote:</span><br>
          </div>
        </div>
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">If a function select data
            from a table, and the rows in the table may <br>
            change, would that function qualify for Immutable or does it
            have to be <br>
            Stable?  I'm asking because according to the docs [1]: "An
            IMMUTABLE <br>
            function cannot modify the database and is guaranteed to
            return the same <br>
            results given the same arguments forever".<br>
            <br>
            So for the same arguments, the result would change only if
            the data in <br>
            the table changes.  Does that mean that it violates the
            "forever" clause <br>
            and therefore can be only marked as Stable and not
            Immutable?<br>
          </blockquote>
          <div><br>
          </div>
          <div class="gmail_default"
            style="font-family:arial,helvetica,sans-serif">Yes</div>
          <div class="gmail_default"
            style="font-family:arial,helvetica,sans-serif"><br>
          </div>
          <div class="gmail_default"
            style="font-family:arial,helvetica,sans-serif">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.</div>
        </div>
      </div>
    </blockquote>
    <p>Thanks for clarifying, David.<br>
    </p>
    <p>Igal<br>
      <br>
    </p>
  </body>
</html>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic