@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $ PostgreSQL : pgsql / src / backend / utils / cache / syscache . c , v 1.101 2005 / 10 / 15 02 : 49 : 32 momjian Exp $
* $ PostgreSQL : pgsql / src / backend / utils / cache / syscache . c , v 1.101 .2 .1 2006 / 10 / 06 18 : 23 : 41 tgl Exp $
*
*
* NOTES
* NOTES
* These routines allow the parser / planner / executor to perform
* These routines allow the parser / planner / executor to perform
@ -494,7 +494,7 @@ InitCatalogCachePhase2(void)
Assert ( CacheInitialized ) ;
Assert ( CacheInitialized ) ;
for ( cacheId = 0 ; cacheId < SysCacheSize ; cacheId + + )
for ( cacheId = 0 ; cacheId < SysCacheSize ; cacheId + + )
InitCatCachePhase2 ( SysCache [ cacheId ] ) ;
InitCatCachePhase2 ( SysCache [ cacheId ] , true ) ;
}
}
@ -691,6 +691,9 @@ SearchSysCacheExistsAttName(Oid relid, const char *attname)
* As with heap_getattr ( ) , if the attribute is of a pass - by - reference type
* As with heap_getattr ( ) , if the attribute is of a pass - by - reference type
* then a pointer into the tuple data area is returned - - - the caller must
* then a pointer into the tuple data area is returned - - - the caller must
* not modify or pfree the datum !
* not modify or pfree the datum !
*
* Note : it is legal to use SysCacheGetAttr ( ) with a cacheId referencing
* a different cache for the same catalog the tuple was fetched from .
*/
*/
Datum
Datum
SysCacheGetAttr ( int cacheId , HeapTuple tup ,
SysCacheGetAttr ( int cacheId , HeapTuple tup ,
@ -699,15 +702,18 @@ SysCacheGetAttr(int cacheId, HeapTuple tup,
{
{
/*
/*
* We just need to get the TupleDesc out of the cache entry , and then we
* We just need to get the TupleDesc out of the cache entry , and then we
* can apply heap_getattr ( ) . We expect that the cache control data is
* can apply heap_getattr ( ) . Normally the cache control data is already
* currently valid - - - if the caller recently fetched the tuple , then it
* valid ( because the caller recently fetched the tuple via this same
* should b e.
* cache ) , but there are cases where we have to initialize the cache her e.
*/
*/
if ( cacheId < 0 | | cacheId > = SysCacheSize )
if ( cacheId < 0 | | cacheId > = SysCacheSize | |
! PointerIsValid ( SysCache [ cacheId ] ) )
elog ( ERROR , " invalid cache id: %d " , cacheId ) ;
elog ( ERROR , " invalid cache id: %d " , cacheId ) ;
if ( ! PointerIsValid ( SysCache [ cacheId ] ) | |
if ( ! PointerIsValid ( SysCache [ cacheId ] - > cc_tupdesc ) )
! PointerIsValid ( SysCache [ cacheId ] - > cc_tupdesc ) )
{
elog ( ERROR , " missing cache data for cache id %d " , cacheId ) ;
InitCatCachePhase2 ( SysCache [ cacheId ] , false ) ;
Assert ( PointerIsValid ( SysCache [ cacheId ] - > cc_tupdesc ) ) ;
}
return heap_getattr ( tup , attributeNumber ,
return heap_getattr ( tup , attributeNumber ,
SysCache [ cacheId ] - > cc_tupdesc ,
SysCache [ cacheId ] - > cc_tupdesc ,