diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-05-28 17:56:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-05-28 17:56:29 +0000 |
commit | 0a7fb4e9184539afcb6fed0f1d2bc0abddc2b0a6 (patch) | |
tree | affcce1c5b6367468fb6dcfd2790585f2e967629 /src/backend/access | |
parent | 5005bb060b3f3a82cd1bd662c7f8946c9be59db5 (diff) | |
download | postgresql-0a7fb4e9184539afcb6fed0f1d2bc0abddc2b0a6.tar.gz postgresql-0a7fb4e9184539afcb6fed0f1d2bc0abddc2b0a6.zip |
First round of changes for new fmgr interface. fmgr itself and the
key call sites are changed, but most called functions are still oldstyle.
An exception is that the PL managers are updated (so, for example, NULL
handling now behaves as expected in plperl and plpgsql functions).
NOTE initdb is forced due to added column in pg_proc.
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/common/Makefile | 9 | ||||
-rw-r--r-- | src/backend/access/index/indexam.c | 47 | ||||
-rw-r--r-- | src/backend/access/index/istrat.c | 3 |
3 files changed, 35 insertions, 24 deletions
diff --git a/src/backend/access/common/Makefile b/src/backend/access/common/Makefile index 594ed50a59d..847b06b1d21 100644 --- a/src/backend/access/common/Makefile +++ b/src/backend/access/common/Makefile @@ -4,7 +4,7 @@ # Makefile for access/common # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/access/common/Makefile,v 1.16 2000/01/19 02:58:50 petere Exp $ +# $Header: /cvsroot/pgsql/src/backend/access/common/Makefile,v 1.17 2000/05/28 17:55:52 tgl Exp $ # #------------------------------------------------------------------------- @@ -21,12 +21,7 @@ all: SUBSYS.o SUBSYS.o: $(OBJS) $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) -heaptuple.o heapvalid.o tupdesc.o: ../../fmgr.h - -../../fmgr.h: - $(MAKE) -C ../.. fmgr.h - -dep depend: ../../fmgr.h +dep depend: $(CC) -MM $(CFLAGS) *.c >depend clean: diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c index e0672667c7f..43d8a3850f5 100644 --- a/src/backend/access/index/indexam.c +++ b/src/backend/access/index/indexam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.42 2000/04/12 17:14:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.43 2000/05/28 17:55:52 tgl Exp $ * * INTERFACE ROUTINES * index_open - open an index relation by relationId @@ -418,28 +418,43 @@ GetIndexValue(HeapTuple tuple, bool *attNull) { Datum returnVal; - bool isNull = FALSE; if (PointerIsValid(fInfo) && FIgetProcOid(fInfo) != InvalidOid) { - int i; - Datum *attData = (Datum *) palloc(FIgetnArgs(fInfo) * sizeof(Datum)); + FmgrInfo flinfo; + FunctionCallInfoData fcinfo; + int i; + bool anynull = false; + + /* + * XXX ought to store lookup info in FuncIndexInfo so it need not + * be repeated on each call? + */ + fmgr_info(FIgetProcOid(fInfo), &flinfo); + + MemSet(&fcinfo, 0, sizeof(fcinfo)); + fcinfo.flinfo = &flinfo; + fcinfo.nargs = FIgetnArgs(fInfo); for (i = 0; i < FIgetnArgs(fInfo); i++) { - attData[i] = heap_getattr(tuple, - attrNums[i], - hTupDesc, - attNull); - if (*attNull) - isNull = TRUE; + fcinfo.arg[i] = heap_getattr(tuple, + attrNums[i], + hTupDesc, + &fcinfo.argnull[i]); + anynull |= fcinfo.argnull[i]; + } + if (flinfo.fn_strict && anynull) + { + /* force a null result for strict function */ + returnVal = (Datum) 0; + *attNull = true; + } + else + { + returnVal = FunctionCallInvoke(&fcinfo); + *attNull = fcinfo.isnull; } - returnVal = (Datum) fmgr_array_args(FIgetProcOid(fInfo), - FIgetnArgs(fInfo), - (char **) attData, - &isNull); - pfree(attData); - *attNull = isNull; } else returnVal = heap_getattr(tuple, attrNums[attOff], hTupDesc, attNull); diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c index b0864e505fa..5116b622dd1 100644 --- a/src/backend/access/index/istrat.c +++ b/src/backend/access/index/istrat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.42 2000/04/12 17:14:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.43 2000/05/28 17:55:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -24,6 +24,7 @@ #include "catalog/pg_index.h" #include "catalog/pg_operator.h" #include "miscadmin.h" +#include "utils/fmgroids.h" #include "utils/syscache.h" #ifdef USE_ASSERT_CHECKING |