Hi,
On 2013-07-11 11:53:57 -0700, Jeff Davis wrote:
> On Thu, 2013-07-11 at 10:28 +0200, Andres Freund wrote:
> > There doesn't seem be an explicitly stated rule that we cannot use the
> > syscaches outside of a transaction - but effectively that's required
> > atm.
>
> Aren't there other things that already required that before the MVCC
> catalog snapshot patch went in? For instance, if you get a syscache
> miss, you have to load from the catalogs, meaning you need to acquire a
> lock.
There are. Several. I am blaming it on conference induced haze. Or such.
On 2013-07-11 15:09:45 -0400, Tom Lane wrote:
> It never has been, and never will be, allowed to call the catcache code
> without being in a transaction. What do you think will happen if the
> requested row isn't in cache? A table access, that's what, and that
> absolutely requires being in a transaction.
Makes sense. I was confused because I thought I saw a
get_database_name() and other users outside of a transaction but that
turned out not looking closely enough.
I'd like to add an Assert like in the attached patch making sure we're
in a transaction. Otherwise it's far too easy not to hit an error during
development because everything is cached - and syscache usage isn't
always obvious from the outside to the naive or the tired.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services