1
0
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:
Tom Lane
2002-04-05 00:31:36 +00:00
parent 0e11aea246
commit 4bdb4be62e
26 changed files with 1668 additions and 1542 deletions

View File

@ -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;
}