Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0a7fb4e

Browse files
committed
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.
1 parent 5005bb0 commit 0a7fb4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3764
-2893
lines changed

src/backend/Makefile

+8-11
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#
3535
#
3636
# IDENTIFICATION
37-
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.47 2000/05/11 17:46:28 momjian Exp $
37+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.48 2000/05/28 17:55:51 tgl Exp $
3838
#
3939
#-------------------------------------------------------------------------
4040

@@ -79,7 +79,7 @@ all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source \
7979
global1.description local1_template1.description
8080

8181
ifneq ($(PORTNAME), win)
82-
postgres: fmgr.h $(OBJS) $(VERSIONOBJ)
82+
postgres: utils/fmgroids.h $(OBJS) $(VERSIONOBJ)
8383
$(CC) $(CFLAGS) -o postgres $(OBJS) $(OBJS1) $(VERSIONOBJ) $(LDFLAGS)
8484
else
8585
postgres: $(DLLOBJS) $(SRCDIR)/utils/dllinit.o postgres.def libpostgres.a
@@ -126,15 +126,12 @@ parse.h: parser/parse.h
126126
parser/parse.h:
127127
$(MAKE) -C parser parse.h
128128

129-
fmgr.h: utils/fmgr.h
130-
cp utils/fmgr.h .
131-
132-
utils/fmgr.h:
133-
$(MAKE) -C utils fmgr.h
129+
utils/fmgroids.h:
130+
$(MAKE) -C utils fmgroids.h
134131

135132
#############################################################################
136133
clean:
137-
rm -f postgres$(X) $(POSTGRES_IMP) fmgr.h parse.h \
134+
rm -f postgres$(X) $(POSTGRES_IMP) parse.h \
138135
global1.bki.source local1_template1.bki.source \
139136
global1.description local1_template1.description
140137
ifeq ($(PORTNAME), win)
@@ -205,7 +202,7 @@ install-templates: $(TEMPLATEDIR) \
205202
$(INSTALL) $(INSTLOPTS) pg_options.sample \
206203
$(TEMPLATEDIR)/pg_options.sample
207204

208-
install-headers: fmgr.h $(SRCDIR)/include/config.h
205+
install-headers: utils/fmgroids.h $(SRCDIR)/include/config.h
209206
-@if [ ! -d $(HEADERDIR) ]; then mkdir $(HEADERDIR); fi
210207
-@if [ ! -d $(HEADERDIR)/port ]; then mkdir $(HEADERDIR)/port; fi
211208
-@if [ ! -d $(HEADERDIR)/port/$(PORTNAME) ]; \
@@ -222,8 +219,6 @@ install-headers: fmgr.h $(SRCDIR)/include/config.h
222219
then mkdir $(HEADERDIR)/executor; fi
223220
-@if [ ! -d $(HEADERDIR)/commands ]; \
224221
then mkdir $(HEADERDIR)/commands; fi
225-
$(INSTALL) $(INSTLOPTS) fmgr.h \
226-
$(HEADERDIR)/fmgr.h
227222
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/os.h \
228223
$(HEADERDIR)/os.h
229224
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/config.h \
@@ -244,6 +239,8 @@ install-headers: fmgr.h $(SRCDIR)/include/config.h
244239
$(HEADERDIR)/utils/geo_decls.h
245240
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/elog.h \
246241
$(HEADERDIR)/utils/elog.h
242+
$(INSTALL) $(INSTLOPTS) utils/fmgroids.h \
243+
$(HEADERDIR)/utils/fmgroids.h
247244
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/palloc.h \
248245
$(HEADERDIR)/utils/palloc.h
249246
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/mcxt.h \

src/backend/access/common/Makefile

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/common
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/access/common/Makefile,v 1.16 2000/01/19 02:58:50 petere Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/access/common/Makefile,v 1.17 2000/05/28 17:55:52 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -21,12 +21,7 @@ all: SUBSYS.o
2121
SUBSYS.o: $(OBJS)
2222
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
2323

24-
heaptuple.o heapvalid.o tupdesc.o: ../../fmgr.h
25-
26-
../../fmgr.h:
27-
$(MAKE) -C ../.. fmgr.h
28-
29-
dep depend: ../../fmgr.h
24+
dep depend:
3025
$(CC) -MM $(CFLAGS) *.c >depend
3126

3227
clean:

src/backend/access/index/indexam.c

+31-16
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.42 2000/04/12 17:14:47 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.43 2000/05/28 17:55:52 tgl Exp $
1212
*
1313
* INTERFACE ROUTINES
1414
* index_open - open an index relation by relationId
@@ -418,28 +418,43 @@ GetIndexValue(HeapTuple tuple,
418418
bool *attNull)
419419
{
420420
Datum returnVal;
421-
bool isNull = FALSE;
422421

423422
if (PointerIsValid(fInfo) && FIgetProcOid(fInfo) != InvalidOid)
424423
{
425-
int i;
426-
Datum *attData = (Datum *) palloc(FIgetnArgs(fInfo) * sizeof(Datum));
424+
FmgrInfo flinfo;
425+
FunctionCallInfoData fcinfo;
426+
int i;
427+
bool anynull = false;
428+
429+
/*
430+
* XXX ought to store lookup info in FuncIndexInfo so it need not
431+
* be repeated on each call?
432+
*/
433+
fmgr_info(FIgetProcOid(fInfo), &flinfo);
434+
435+
MemSet(&fcinfo, 0, sizeof(fcinfo));
436+
fcinfo.flinfo = &flinfo;
437+
fcinfo.nargs = FIgetnArgs(fInfo);
427438

428439
for (i = 0; i < FIgetnArgs(fInfo); i++)
429440
{
430-
attData[i] = heap_getattr(tuple,
431-
attrNums[i],
432-
hTupDesc,
433-
attNull);
434-
if (*attNull)
435-
isNull = TRUE;
441+
fcinfo.arg[i] = heap_getattr(tuple,
442+
attrNums[i],
443+
hTupDesc,
444+
&fcinfo.argnull[i]);
445+
anynull |= fcinfo.argnull[i];
446+
}
447+
if (flinfo.fn_strict && anynull)
448+
{
449+
/* force a null result for strict function */
450+
returnVal = (Datum) 0;
451+
*attNull = true;
452+
}
453+
else
454+
{
455+
returnVal = FunctionCallInvoke(&fcinfo);
456+
*attNull = fcinfo.isnull;
436457
}
437-
returnVal = (Datum) fmgr_array_args(FIgetProcOid(fInfo),
438-
FIgetnArgs(fInfo),
439-
(char **) attData,
440-
&isNull);
441-
pfree(attData);
442-
*attNull = isNull;
443458
}
444459
else
445460
returnVal = heap_getattr(tuple, attrNums[attOff], hTupDesc, attNull);

src/backend/access/index/istrat.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.42 2000/04/12 17:14:47 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.43 2000/05/28 17:55:52 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -24,6 +24,7 @@
2424
#include "catalog/pg_index.h"
2525
#include "catalog/pg_operator.h"
2626
#include "miscadmin.h"
27+
#include "utils/fmgroids.h"
2728
#include "utils/syscache.h"
2829

2930
#ifdef USE_ASSERT_CHECKING

src/backend/bootstrap/bootstrap.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.81 2000/04/12 17:14:54 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.82 2000/05/28 17:55:53 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -34,6 +34,7 @@
3434
#include "miscadmin.h"
3535
#include "tcop/tcopprot.h"
3636
#include "utils/builtins.h"
37+
#include "utils/fmgroids.h"
3738
#include "utils/lsyscache.h"
3839
#include "utils/portal.h"
3940

src/backend/catalog/heap.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.128 2000/05/25 21:25:32 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.129 2000/05/28 17:55:54 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -63,6 +63,7 @@
6363
#include "tcop/tcopprot.h"
6464
#include "utils/builtins.h"
6565
#include "utils/catcache.h"
66+
#include "utils/fmgroids.h"
6667
#include "utils/portal.h"
6768
#include "utils/relcache.h"
6869
#include "utils/syscache.h"
@@ -1148,7 +1149,7 @@ RelationTruncateIndexes(Relation heapRelation)
11481149
/* If a valid where predicate, compute predicate Node */
11491150
if (VARSIZE(&index->indpred) != 0)
11501151
{
1151-
predString = fmgr(F_TEXTOUT, &index->indpred);
1152+
predString = textout(&index->indpred);
11521153
oldPred = stringToNode(predString);
11531154
pfree(predString);
11541155
}

src/backend/catalog/index.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.110 2000/05/20 23:11:28 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.111 2000/05/28 17:55:54 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -42,6 +42,7 @@
4242
#include "storage/smgr.h"
4343
#include "utils/builtins.h"
4444
#include "utils/catcache.h"
45+
#include "utils/fmgroids.h"
4546
#include "utils/relcache.h"
4647
#include "utils/syscache.h"
4748
#include "utils/temprel.h"
@@ -688,11 +689,11 @@ UpdateIndexRelation(Oid indexoid,
688689
if (predicate != NULL)
689690
{
690691
predString = nodeToString(predicate);
691-
predText = (text *) fmgr(F_TEXTIN, predString);
692+
predText = textin(predString);
692693
pfree(predString);
693694
}
694695
else
695-
predText = (text *) fmgr(F_TEXTIN, "");
696+
predText = textin("");
696697

697698
predLen = VARSIZE(predText);
698699
itupLen = predLen + sizeof(FormData_pg_index);
@@ -832,11 +833,11 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
832833
if (newPred != NULL)
833834
{
834835
predString = nodeToString(newPred);
835-
predText = (text *) fmgr(F_TEXTIN, predString);
836+
predText = textin(predString);
836837
pfree(predString);
837838
}
838839
else
839-
predText = (text *) fmgr(F_TEXTIN, "");
840+
predText = textin("");
840841

841842
/* open the index system catalog relation */
842843
pg_index = heap_openr(IndexRelationName, RowExclusiveLock);
@@ -2109,7 +2110,7 @@ reindex_index(Oid indexId, bool force)
21092110
/* If a valid where predicate, compute predicate Node */
21102111
if (VARSIZE(&index->indpred) != 0)
21112112
{
2112-
predString = fmgr(F_TEXTOUT, &index->indpred);
2113+
predString = textout(&index->indpred);
21132114
oldPred = stringToNode(predString);
21142115
pfree(predString);
21152116
}

src/backend/catalog/indexing.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.60 2000/04/12 17:14:56 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.61 2000/05/28 17:55:54 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -24,6 +24,7 @@
2424
#include "catalog/indexing.h"
2525
#include "catalog/pg_index.h"
2626
#include "miscadmin.h"
27+
#include "utils/fmgroids.h"
2728
#include "utils/syscache.h"
2829

2930
/*

src/backend/catalog/pg_operator.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.49 2000/01/26 05:56:10 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.50 2000/05/28 17:55:54 tgl Exp $
1212
*
1313
* NOTES
1414
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -26,6 +26,7 @@
2626
#include "miscadmin.h"
2727
#include "parser/parse_func.h"
2828
#include "utils/builtins.h"
29+
#include "utils/fmgroids.h"
2930
#include "utils/syscache.h"
3031

3132

0 commit comments

Comments
 (0)