mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Divide functions into three volatility classes (immutable, stable, and
volatile), rather than the old cachable/noncachable distinction. This allows indexscan optimizations in many places where we formerly didn't. Also, add a pronamespace column to pg_proc (it doesn't do anything yet, however).
This commit is contained in:
24
src/backend/utils/cache/lsyscache.c
vendored
24
src/backend/utils/cache/lsyscache.c
vendored
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.68 2002/04/02 01:03:07 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.69 2002/04/05 00:31:30 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Eventually, the index information should go through here, too.
|
||||
@ -470,19 +470,19 @@ op_hashjoinable(Oid opno, Oid ltype, Oid rtype)
|
||||
}
|
||||
|
||||
/*
|
||||
* op_iscachable
|
||||
* op_volatile
|
||||
*
|
||||
* Get the proiscachable flag for the operator's underlying function.
|
||||
* Get the provolatile flag for the operator's underlying function.
|
||||
*/
|
||||
bool
|
||||
op_iscachable(Oid opno)
|
||||
char
|
||||
op_volatile(Oid opno)
|
||||
{
|
||||
RegProcedure funcid = get_opcode(opno);
|
||||
|
||||
if (funcid == (RegProcedure) InvalidOid)
|
||||
elog(ERROR, "Operator OID %u does not exist", opno);
|
||||
|
||||
return func_iscachable((Oid) funcid);
|
||||
return func_volatile((Oid) funcid);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -613,14 +613,14 @@ get_func_rettype(Oid funcid)
|
||||
}
|
||||
|
||||
/*
|
||||
* func_iscachable
|
||||
* Given procedure id, return the function's proiscachable flag.
|
||||
* func_volatile
|
||||
* Given procedure id, return the function's provolatile flag.
|
||||
*/
|
||||
bool
|
||||
func_iscachable(Oid funcid)
|
||||
char
|
||||
func_volatile(Oid funcid)
|
||||
{
|
||||
HeapTuple tp;
|
||||
bool result;
|
||||
char result;
|
||||
|
||||
tp = SearchSysCache(PROCOID,
|
||||
ObjectIdGetDatum(funcid),
|
||||
@ -628,7 +628,7 @@ func_iscachable(Oid funcid)
|
||||
if (!HeapTupleIsValid(tp))
|
||||
elog(ERROR, "Function OID %u does not exist", funcid);
|
||||
|
||||
result = ((Form_pg_proc) GETSTRUCT(tp))->proiscachable;
|
||||
result = ((Form_pg_proc) GETSTRUCT(tp))->provolatile;
|
||||
ReleaseSysCache(tp);
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user