From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bryn Llewellyn <bryn@yugabyte.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Wrong results from function that selects from vier after "created or replace"
Date: Mon, 12 Oct 2020 20:38:10 -0400
Message-ID: <3401031.1602549490@sss.pgh.pa.us> (raw)
In-Reply-To: <4DE6C9D8-77A5-4858-82CB-18728F59D715@yugabyte.com>
References: <4DE6C9D8-77A5-4858-82CB-18728F59D715@yugabyte.com>
Bryn Llewellyn <bryn@yugabyte.com> writes:
> The attached self-contained testcase, "pg-bad-invalidation-bug.sql", seems to me definitely to demonstrate a bug. I've attached the spooled output as "pg-bad-invalidation-bug.txt" Do you agree that this is a bug?
No. You marked the functions as "immutable", and then you broke that
promise by changing what they'd need to output. The planner had
already inlined the original output value of f1() into the calling
expressions in f2(), on the strength of it being allegedly immutable.
There is no mechanism for undoing that (short of a forced cache flush
or session end), nor should there need to be.
If I mark the functions as either stable or volatile, I see the
desired behavior.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, bryn@yugabyte.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Wrong results from function that selects from vier after "created or replace"
In-Reply-To: <3401031.1602549490@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox