Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfbbP-0005bl-G2 for pgsql-general@arkaria.postgresql.org; Tue, 25 Jun 2019 02:54:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hfbbN-0003tf-36 for pgsql-general@arkaria.postgresql.org; Tue, 25 Jun 2019 02:54:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfbbM-0003tV-Lu for pgsql-general@lists.postgresql.org; Tue, 25 Jun 2019 02:54:32 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfbbK-0000Mw-76 for pgsql-general@postgresql.org; Tue, 25 Jun 2019 02:54:31 +0000 Received: by mail-ot1-x32e.google.com with SMTP id b7so15666819otl.11 for ; Mon, 24 Jun 2019 19:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lucee.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=ydyji1QtcHUogMwAzMxxuV2WVZr/7qoVoR9sihcsvVw=; b=TsthiCgpc3mNdSQ3c14SPqBcMCwS5c58J7zwxny8nRTEdk7yOSluxijTs3FgTG8VAi C7sAJhZ9q/EA45yfqrSm5uKo5eoFC+uenAEG8F8mjsS3OhywIF//Ku1bgDyWg5dgQKxz 46UI4I47inwz91qCFQ35dmWqdN117UYTNCygWhZ0liuwcKw+RUS35K25692x6vS/imcS 4le3ubDPYECwXWPL221VI0aQxaXRwouJbFXOeCT9PElqXS6voxIhQwCfYUd4mmeCJA93 mQ6U/ZVf/2MHY8gG12+tzmrOGjQNKtXjHN01EmCjI4N/mR6r4lVJklra2/ydsZpTWHKi /gkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=ydyji1QtcHUogMwAzMxxuV2WVZr/7qoVoR9sihcsvVw=; b=P8M1F+T9+5kwKqYX73f3VAbdRntEM1lPlacNj/p1hyyHJd5B9TWarmmSAOha4o1Ib3 /l/Ccef7LCieO7xS8Xc4OYNOuOHHgJcl/2urJ+OPTaSre4NExKJrGMVZ49YOrzfnViSZ biMEVfOAFPMKwtQoa3wIAGjKhWf9VJTpb++uVxH81AhLm9hiC3NOADDSO9xSqY0ihFmT YLACqklE0okQ5ywXlVj2n7xcnw0hseQTcywunx6plrriaspJbrqyvrV9WsZEXhVGBf/4 FYD1PPNPMSg7jzOuJbHe4uew0kdFz3tllCyGh+dkobCbiWCT006cXnggbh/djwndW+pd 3Psw== X-Gm-Message-State: APjAAAU0ml64iK5rjJkOMTGBilasq/NJ1ZIleMsRLuj1qiIKWAszzpiQ FlNsMx2iDUbT6YEM92/k4/lu83AgsXM= X-Google-Smtp-Source: APXvYqyOlOL/DhGOu21tn+kUlzyAK0WHPwaa2l1ebNlgbSloPUqTMjqE6nUO6IsMo17Mtfr3Kewomw== X-Received: by 2002:a9d:73d0:: with SMTP id m16mr23183123otk.190.1561431269181; Mon, 24 Jun 2019 19:54:29 -0700 (PDT) Received: from ?IPv6:2600:1700:4000:8120:f44a:713f:e113:9eca? ([2600:1700:4000:8120:f44a:713f:e113:9eca]) by smtp.googlemail.com with ESMTPSA id q20sm4708351otm.32.2019.06.24.19.54.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 19:54:28 -0700 (PDT) Subject: Re: Function Volatility Stable vs Immutable To: "David G. Johnston" Cc: pgsql-general References: <8a4ed1a2-74de-0fa3-e2a2-7b68b60b0a4f@lucee.org> From: "Igal @ Lucee.org" Message-ID: Date: Mon, 24 Jun 2019 19:54:27 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------A3975A471055FC40201C6603" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------A3975A471055FC40201C6603 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 6/24/2019 7:38 PM, David G. Johnston wrote: > On Mon, Jun 24, 2019 at 7:31 PM 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 --------------A3975A471055FC40201C6603 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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> 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

--------------A3975A471055FC40201C6603--