Skip to content

Commit baef78d

Browse files
author
PostgreSQL Daemon
committed
Thank god for searchable mail archives.
Patch by: wieck@sapserv.debis.de (Jan Wieck) One of the design rules of PostgreSQL is extensibility. And to follow this rule means (at least for me) that there should not only be a builtin PL. Instead I would prefer a defined interface for PL implemetations.
1 parent 763ff8a commit baef78d

File tree

37 files changed

+344
-402
lines changed

37 files changed

+344
-402
lines changed

src/Makefile.global.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.31 1997/12/20 18:36:26 scrappy Exp $
10+
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.32 1998/01/15 19:41:35 pgsql Exp $
1111
#
1212
# NOTES
1313
# Essentially all Postgres make files include this file and use the
@@ -206,7 +206,7 @@ YFLAGS= @YFLAGS@
206206
YACC= @YACC@
207207
LEX= @LEX@
208208
AROPT= @AROPT@
209-
CFLAGS= -I$(SRCDIR)/include @CPPFLAGS@ @CFLAGS@
209+
CFLAGS= -I$(SRCDIR)/include -I$(SRCDIR)/backend @CPPFLAGS@ @CFLAGS@
210210
CFLAGS_SL= @SHARED_LIB@
211211
LDFLAGS= @LDFLAGS@ @LIBS@
212212
DLSUFFIX= @DLSUFFIX@

src/backend/access/common/Makefile

Lines changed: 2 additions & 2 deletions
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.8 1997/12/20 00:22:11 scrappy Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/access/common/Makefile,v 1.9 1998/01/15 19:41:42 pgsql Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -23,7 +23,7 @@ all: SUBSYS.o
2323
SUBSYS.o: $(OBJS)
2424
$(LD) -r -o SUBSYS.o $(OBJS)
2525

26-
heapvalid.o tupdesc.o: ../../fmgr.h
26+
heaptuple.o heapvalid.o tupdesc.o: ../../fmgr.h
2727

2828
../../fmgr.h:
2929
$(MAKE) -C ../.. fmgr.h

src/backend/access/common/indexvalid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.16 1997/09/08 02:19:55 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.17 1998/01/15 19:41:44 pgsql Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -66,13 +66,13 @@ index_keytest(IndexTuple tuple,
6666

6767
if (key[0].sk_flags & SK_COMMUTE)
6868
{
69-
test = (*(key[0].sk_func))
69+
test = (*(fmgr_faddr(&key[0].sk_func)))
7070
(DatumGetPointer(key[0].sk_argument),
7171
datum) ? 1 : 0;
7272
}
7373
else
7474
{
75-
test = (*(key[0].sk_func))
75+
test = (*(fmgr_faddr(&key[0].sk_func)))
7676
(datum,
7777
DatumGetPointer(key[0].sk_argument)) ? 1 : 0;
7878
}

src/backend/access/common/scankey.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.10 1997/09/07 04:37:39 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.11 1998/01/15 19:41:46 pgsql Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -61,7 +61,8 @@ ScanKeyEntryInitialize(ScanKey entry,
6161
entry->sk_attno = attributeNumber;
6262
entry->sk_procedure = procedure;
6363
entry->sk_argument = argument;
64-
fmgr_info(procedure, &entry->sk_func, &entry->sk_nargs);
64+
fmgr_info(procedure, &entry->sk_func);
65+
entry->sk_nargs = entry->sk_func.fn_nargs;
6566

6667
Assert(ScanKeyEntryIsLegal(entry));
6768
}

src/backend/access/gist/gist.c

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,10 @@ gistAdjustKeys(Relation r,
565565
ev1p = &((GISTENTRY *) VARDATA(evec))[1];
566566

567567
/* form union of decompressed entries */
568-
datum = (char *) (giststate->unionFn) (evec, &datumsize);
568+
datum = (*fmgr_faddr(&giststate->unionFn)) (evec, &datumsize);
569569

570570
/* did union leave decompressed version of oldud unchanged? */
571-
(giststate->equalFn) (ev0p->pred, datum, &result);
571+
(*fmgr_faddr(&giststate->equalFn)) (ev0p->pred, datum, &result);
572572
if (!result)
573573
{
574574
TupleDesc td = RelationGetTupleDescriptor(r);
@@ -743,7 +743,7 @@ gistSplit(Relation r,
743743
VARSIZE(entryvec) = (maxoff + 2) * sizeof(GISTENTRY) + VARHDRSZ;
744744

745745
/* now let the user-defined picksplit function set up the split vector */
746-
(giststate->picksplitFn) (entryvec, &v);
746+
(*fmgr_faddr(&giststate->picksplitFn)) (entryvec, &v);
747747

748748
/* compress ldatum and rdatum */
749749
gistcentryinit(giststate, &tmpentry, v.spl_ldatum, (Relation) NULL,
@@ -1072,7 +1072,7 @@ gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */
10721072
size = IndexTupleSize(datum) - sizeof(IndexTupleData);
10731073
datum += sizeof(IndexTupleData);
10741074
gistdentryinit(giststate, &entry, datum, r, p, i, size, FALSE);
1075-
(giststate->penaltyFn) (&entry, &identry, &usize);
1075+
(*fmgr_faddr(&giststate->penaltyFn)) (&entry, &identry, &usize);
10761076
if (which_grow < 0 || usize < which_grow)
10771077
{
10781078
which = i;
@@ -1150,8 +1150,6 @@ initGISTstate(GISTSTATE *giststate, Relation index)
11501150
RegProcedure penalty_proc,
11511151
picksplit_proc,
11521152
equal_proc;
1153-
func_ptr user_fn;
1154-
int pronargs;
11551153
HeapTuple htup;
11561154
IndexTupleForm itupform;
11571155

@@ -1162,20 +1160,13 @@ initGISTstate(GISTSTATE *giststate, Relation index)
11621160
penalty_proc = index_getprocid(index, 1, GIST_PENALTY_PROC);
11631161
picksplit_proc = index_getprocid(index, 1, GIST_PICKSPLIT_PROC);
11641162
equal_proc = index_getprocid(index, 1, GIST_EQUAL_PROC);
1165-
fmgr_info(consistent_proc, &user_fn, &pronargs);
1166-
giststate->consistentFn = user_fn;
1167-
fmgr_info(union_proc, &user_fn, &pronargs);
1168-
giststate->unionFn = user_fn;
1169-
fmgr_info(compress_proc, &user_fn, &pronargs);
1170-
giststate->compressFn = user_fn;
1171-
fmgr_info(decompress_proc, &user_fn, &pronargs);
1172-
giststate->decompressFn = user_fn;
1173-
fmgr_info(penalty_proc, &user_fn, &pronargs);
1174-
giststate->penaltyFn = user_fn;
1175-
fmgr_info(picksplit_proc, &user_fn, &pronargs);
1176-
giststate->picksplitFn = user_fn;
1177-
fmgr_info(equal_proc, &user_fn, &pronargs);
1178-
giststate->equalFn = user_fn;
1163+
fmgr_info(consistent_proc, &giststate->consistentFn);
1164+
fmgr_info(union_proc, &giststate->unionFn);
1165+
fmgr_info(compress_proc, &giststate->compressFn);
1166+
fmgr_info(decompress_proc, &giststate->decompressFn);
1167+
fmgr_info(penalty_proc, &giststate->penaltyFn);
1168+
fmgr_info(picksplit_proc, &giststate->picksplitFn);
1169+
fmgr_info(equal_proc, &giststate->equalFn);
11791170

11801171
/* see if key type is different from type of attribute being indexed */
11811172
htup = SearchSysCacheTuple(INDEXRELID, ObjectIdGetDatum(index->rd_id),
@@ -1259,7 +1250,7 @@ gistdentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr, Relation r,
12591250
gistentryinit(*e, pr, r, pg, o, b, l);
12601251
if (giststate->haskeytype)
12611252
{
1262-
dep = (GISTENTRY *) ((giststate->decompressFn) (e));
1253+
dep = (GISTENTRY *) ((*fmgr_faddr(&giststate->decompressFn)) (e));
12631254
gistentryinit(*e, dep->pred, dep->rel, dep->page, dep->offset, dep->bytes,
12641255
dep->leafkey);
12651256
if (dep != e)
@@ -1280,7 +1271,7 @@ gistcentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr, Relation r,
12801271
gistentryinit(*e, pr, r, pg, o, b, l);
12811272
if (giststate->haskeytype)
12821273
{
1283-
cep = (GISTENTRY *) ((giststate->compressFn) (e));
1274+
cep = (GISTENTRY *) ((*fmgr_faddr(&giststate->compressFn)) (e));
12841275
gistentryinit(*e, cep->pred, cep->rel, cep->page, cep->offset, cep->bytes,
12851276
cep->leafkey);
12861277
if (cep != e)

src/backend/access/gist/gistget.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,13 @@ gistindex_keytest(IndexTuple tuple,
283283

284284
if (key[0].sk_flags & SK_COMMUTE)
285285
{
286-
test = (*(key[0].sk_func))
286+
test = (*fmgr_faddr(&key[0].sk_func))
287287
(DatumGetPointer(key[0].sk_argument),
288288
&de, key[0].sk_procedure) ? 1 : 0;
289289
}
290290
else
291291
{
292-
test = (*(key[0].sk_func))
292+
test = (*fmgr_faddr(&key[0].sk_func))
293293
(&de,
294294
DatumGetPointer(key[0].sk_argument),
295295
key[0].sk_procedure) ? 1 : 0;

src/backend/access/index/istrat.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.15 1998/01/07 21:01:45 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.16 1998/01/15 19:42:02 pgsql Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -242,22 +242,22 @@ StrategyTermEvaluate(StrategyTerm term,
242242
switch (operator->flags ^ entry->sk_flags)
243243
{
244244
case 0x0:
245-
tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
245+
tmpres = (long) FMGR_PTR2(&entry->sk_func,
246246
left, right);
247247
break;
248248

249249
case SK_NEGATE:
250-
tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
250+
tmpres = (long) !FMGR_PTR2(&entry->sk_func,
251251
left, right);
252252
break;
253253

254254
case SK_COMMUTE:
255-
tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
255+
tmpres = (long) FMGR_PTR2(&entry->sk_func,
256256
right, left);
257257
break;
258258

259259
case SK_NEGATE | SK_COMMUTE:
260-
tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
260+
tmpres = (long) !FMGR_PTR2(&entry->sk_func,
261261
right, left);
262262
break;
263263

@@ -521,7 +521,8 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
521521
entry->sk_flags = 0;
522522
entry->sk_procedure =
523523
((OperatorTupleForm) GETSTRUCT(tuple))->oprcode;
524-
fmgr_info(entry->sk_procedure, &entry->sk_func, &entry->sk_nargs);
524+
fmgr_info(entry->sk_procedure, &entry->sk_func);
525+
entry->sk_nargs = entry->sk_func.fn_nargs;
525526

526527
if (!RegProcedureIsValid(entry->sk_procedure))
527528
{

src/backend/access/nbtree/nbtinsert.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.24 1998/01/07 21:01:52 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.25 1998/01/15 19:42:10 pgsql Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1487,8 +1487,7 @@ _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
14871487
if (entry->sk_flags & SK_ISNULL || null)
14881488
return (false);
14891489

1490-
result = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
1491-
entry->sk_argument, datum);
1490+
result = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
14921491
if (result != 0)
14931492
return (false);
14941493
}

src/backend/access/nbtree/nbtsearch.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.29 1998/01/07 21:01:56 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.30 1998/01/15 19:42:13 pgsql Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -677,8 +677,7 @@ _bt_compare(Relation rel,
677677
}
678678
else
679679
{
680-
tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
681-
entry->sk_argument, datum);
680+
tmpres = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
682681
}
683682
result = tmpres;
684683

src/backend/access/nbtree/nbtutils.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.17 1998/01/07 21:02:01 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.18 1998/01/15 19:42:15 pgsql Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -263,8 +263,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
263263
{
264264
/* yup, use the appropriate value */
265265
test =
266-
(long) FMGR_PTR2(cur->sk_func, cur->sk_procedure,
267-
cur->sk_argument, xform[j].sk_argument);
266+
(long) FMGR_PTR2(&cur->sk_func, cur->sk_argument, xform[j].sk_argument);
268267
if (test)
269268
xform[j].sk_argument = cur->sk_argument;
270269
else if (j == (BTEqualStrategyNumber - 1))
@@ -381,13 +380,13 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
381380

382381
if (key[0].sk_flags & SK_COMMUTE)
383382
{
384-
test = (int) (*(key[0].sk_func))
383+
test = (int) (*fmgr_faddr(&key[0].sk_func))
385384
(DatumGetPointer(key[0].sk_argument),
386385
datum);
387386
}
388387
else
389388
{
390-
test = (int) (*(key[0].sk_func))
389+
test = (int) (*fmgr_faddr(&key[0].sk_func))
391390
(datum,
392391
DatumGetPointer(key[0].sk_argument));
393392
}

0 commit comments

Comments
 (0)