#include "commands/trigger.h"
#include "string.h"
-extern Datum dupecheck(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1(dupecheck);
+#ifdef PG71
+ extern Datum dupecheck(PG_FUNCTION_ARGS);
+ PG_FUNCTION_INFO_V1(dupecheck);
+#else
+ extern Datum dupecheck(void);
+#endif
+
+#ifdef PG71
Datum dupecheck(PG_FUNCTION_ARGS)
{
-#ifdef PG71
TriggerData *trigdata = (TriggerData *) fcinfo->context;
#else
+Datum dupecheck(void)
+{
TriggerData *trigdata = CurrentTriggerData;
#endif
TupleDesc tupdesc;
if (rowstring == NULL)
{
// Big problem.
+ SPI_finish();
return PointerGetDatum(NULL);
}
if (query == NULL)
{
// Big problem
+ SPI_finish();
return PointerGetDatum(NULL);
}
if ((ret == SPI_OK_SELECT) && (num > 0))
{
elog(NOTICE, "dupecheck: UBD detected, dupe dropped");
+ SPI_finish();
return PointerGetDatum(NULL);
}
else