From: | Marko Tiikkaja <marko(at)joh(dot)to> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-bugs(at)lists(dot)postgresql(dot)org, dejan(dot)petrovic(at)islonline(dot)com |
Subject: | Re: BUG #15060: Row in table not found when using pg function in an expression |
Date: | 2018-02-13 11:08:52 |
Message-ID: | CAL9smLDF9pZ89LWFgO4BcnMZf15EFiaxAhcnjuamS=HOKb+=NQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mon, Feb 12, 2018 at 9:11 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> > So what's happening here is that the function get_bug_id, being stable,
> > is being called speculatively at plan time for the query where it
> > appears in the WHERE clause. For whatever reason, the snapshot it's
> > being run in at that time is not the same one actually used for the
> > later execution of the query, and the plan-time snapshot doesn't see the
> > just-inserted row.
>
> > It looks like what's going on here is that SPI does GetCachedPlan -
> > which is where planning will happen - _before_ establishing the new
> > snapshot in the non-read-only case (read_only is false here because the
> > calling function, test_bug(), is volatile).
>
> Yeah, I came to the same conclusion. I think it's basically accidental
> that the given test case works before 9.2: the reason seems to be that
> in 9.1, the plancache doesn't pass through the parameter list containing
> the value of "my_text", so that the planner is unable to speculatively
> execute get_bug_id(). The order of operations in _SPI_execute_plan
> is just as wrong though.
>
I'm not sure I understand. When's the snapshot used for planning actually
taken here?
.m
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2018-02-13 11:44:38 | BUG #15062: Calling 3 function in one other function |
Previous Message | Michael Paquier | 2018-02-13 05:27:32 | Re: BUG #15061: Cannot use TEMP TABLE ON COMMIT DROP in extension |