Thread: pgsql: Fix SysCacheGetAttr() to handle the case where the specified

pgsql: Fix SysCacheGetAttr() to handle the case where the specified

From
tgl@postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Fix SysCacheGetAttr() to handle the case where the specified syscache has not
been initialized yet.  This can happen because there are code paths that call
SysCacheGetAttr() on a tuple originally fetched from a different syscache
(hopefully on the same catalog) than the one specified in the call.  It
doesn't seem useful or robust to try to prevent that from happening, so just
improve the function to cope instead.  Per bug#2678 from Jeff Trout.  The
specific example shown by Jeff is new in 8.1, but to be on the safe side
I'm backpatching 8.0 as well.  We could patch 7.x similarly but I think
that's probably overkill, given the lack of evidence of old bugs of this ilk.

Tags:
----
REL8_1_STABLE

Modified Files:
--------------
    pgsql/src/backend/utils/cache:
        catcache.c (r1.125.2.2 -> r1.125.2.3)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/catcache.c.diff?r1=1.125.2.2&r2=1.125.2.3)
        syscache.c (r1.101 -> r1.101.2.1)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/syscache.c.diff?r1=1.101&r2=1.101.2.1)
    pgsql/src/include/utils:
        catcache.h (r1.56.2.1 -> r1.56.2.2)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/catcache.h.diff?r1=1.56.2.1&r2=1.56.2.2)