Added support for PostgreSQL 7.0
authormj <mj>
Thu, 27 Sep 2001 22:04:50 +0000 (22:04 +0000)
committermj <mj>
Thu, 27 Sep 2001 22:04:50 +0000 (22:04 +0000)
dbscripts/dupetrigger/Makefile
dbscripts/dupetrigger/dupetrigger.c

index 6185ec2..1d16e39 100755 (executable)
@@ -2,7 +2,9 @@
 
 CC=gcc
 PGINC=/usr/include/postgresql
-CFLAGS=-I$(PGINC)
+PGVERSION=-DPG70
+#PGVERSION=-DPG71
+CFLAGS=-I$(PGINC) $(PGVERSION)
 
 # If changed, also change postgresql.script
 INSTALLDIR=../../../Mir/src
index 11315c6..0bd94ea 100755 (executable)
@@ -103,7 +103,11 @@ static u_long crc32(u_char *buf, unsigned len)
 
 Datum dupecheck(PG_FUNCTION_ARGS)
 {
+#ifdef PG71
        TriggerData *trigdata = (TriggerData *) fcinfo->context;
+#else
+       TriggerData *trigdata = CurrentTrigerData;
+#endif
        TupleDesc       tupdesc;
        HeapTuple       rettuple;
        bool            isnull;
@@ -116,11 +120,13 @@ Datum dupecheck(PG_FUNCTION_ARGS)
                *rowstring,
                *query;
        
-
        /* Make sure trigdata is pointing at what I expect */
+#ifdef PG70
+       if (!CurrentTriggerData)
+#else          
        if (!CALLED_AS_TRIGGER(fcinfo))
+#endif 
                elog(ERROR, "dupecheck: not fired by trigger manager");
-       
        /* tuple to return to Executor */
        if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
                rettuple = trigdata->tg_newtuple;