mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Added utils/adt/ri_triggers with empty shells for the
FOREIGN KEY triggers. Added pg_proc entries for all the new functions. Jan
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
# Makefile for utils/adt
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.25 1999/07/22 18:30:08 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.26 1999/09/30 14:54:22 wieck Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -34,7 +34,8 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o chunk.o \
|
||||
oid.o oracle_compat.o \
|
||||
regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
|
||||
tid.o timestamp.o varchar.o varlena.o version.o \
|
||||
network.o mac.o inet_net_ntop.o inet_net_pton.o
|
||||
network.o mac.o inet_net_ntop.o inet_net_pton.o \
|
||||
ri_triggers.o
|
||||
|
||||
all: SUBSYS.o
|
||||
|
||||
|
||||
184
src/backend/utils/adt/ri_triggers.c
Normal file
184
src/backend/utils/adt/ri_triggers.c
Normal file
@@ -0,0 +1,184 @@
|
||||
/* ----------
|
||||
* ri_triggers.c
|
||||
*
|
||||
* Generic trigger procedures for referential integrity constraint
|
||||
* checks.
|
||||
*
|
||||
* 1999 Jan Wieck
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.1 1999/09/30 14:54:22 wieck Exp $
|
||||
*
|
||||
* ----------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "fmgr.h"
|
||||
|
||||
#include "access/heapam.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/trigger.h"
|
||||
#include "executor/spi.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_check_ins -
|
||||
*
|
||||
* Check foreign key existance at insert event on FK table.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_check_ins (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_check_ins() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_check_upd -
|
||||
*
|
||||
* Check foreign key existance at update event on FK table.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_check_upd (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_check_upd() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_cascade_del -
|
||||
*
|
||||
* Cascaded delete foreign key references at delete event on PK table.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_cascade_del (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_cascade_del() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_cascade_upd -
|
||||
*
|
||||
* Cascaded update/delete foreign key references at update event on PK table.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_cascade_upd (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_cascade_upd() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_restrict_del -
|
||||
*
|
||||
* Restrict delete from PK table to rows unreferenced by foreign key.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_restrict_del (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_restrict_del() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_restrict_upd -
|
||||
*
|
||||
* Restrict update of PK to rows unreferenced by foreign key.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_restrict_upd (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_restrict_upd() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_setnull_del -
|
||||
*
|
||||
* Set foreign key references to NULL values at delete event on PK table.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_setnull_del (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_setnull_del() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_setnull_upd -
|
||||
*
|
||||
* Set foreign key references to NULL at update event on PK table.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_setnull_upd (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_setnull_upd() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_setdefault_del -
|
||||
*
|
||||
* Set foreign key references to defaults at delete event on PK table.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_setdefault_del (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_setdefault_del() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* RI_FKey_setdefault_upd -
|
||||
*
|
||||
* Set foreign key references to defaults at update event on PK table.
|
||||
* ----------
|
||||
*/
|
||||
HeapTuple
|
||||
RI_FKey_setdefault_upd (FmgrInfo *proinfo)
|
||||
{
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
elog(NOTICE, "RI_FKey_setdefault_upd() called\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user