Re: Plan cache and name space behavior in 9.2 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Plan cache and name space behavior in 9.2
Date
Msg-id 20271.1347652513@sss.pgh.pa.us
Whole thread Raw
In response to Plan cache and name space behavior in 9.2  (Hitoshi Harada <umi.tanuki@gmail.com>)
Responses Re: Plan cache and name space behavior in 9.2
List pgsql-hackers
Hitoshi Harada <umi.tanuki@gmail.com> writes:
> I expected success in tname::regclass in the function chck(), but it
> actually fails for your first run in the session.

Really?  Not for me.

In the example as given, I see success for "call 1" and then an error at
"call 2", which is occurring because we're trying to replan the query
with the original search_path, which doesn't include the temp schema
since it didn't exist yet.  (The planner is trying to estimate the value
of the expression 'tname::regclass::oid', which is why this happens
with the old search_path setting --- it wouldn't fail at runtime.)

A replan would have failed in previous versions too, but that's much
less likely in previous versions since you'd need to see a relcache
invalidation on one of the referenced tables to make one happen.

There's been periodic discussion of how the plan cache ought to interact
with search_path anyway --- maybe it shouldn't try to restore the
previous search_path setting but rather view current search_path as part
of the cache lookup key.  I'd be hesitant to back-patch such a behavior
change, though.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: embedded list v2
Next
From: Hitoshi Harada
Date:
Subject: Re: Plan cache and name space behavior in 9.2