1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

Add tgconstrrelid to stored Trigger structures, make RI trigger functions

depend on this rather than the trigger argument strings to locate the
other relation to test.  This makes RI triggers function properly in
the presence of schemas and temp tables.  Along the way, fix bogus lack
of locking in RI triggers, handle quoting of names fully correctly,
compute required sizes of query buffers with some semblance of accuracy.
This commit is contained in:
Tom Lane
2002-04-01 22:36:13 +00:00
parent 6a25cd6b26
commit 789ddcb5fe
6 changed files with 370 additions and 254 deletions

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: trigger.h,v 1.33 2002/03/29 22:10:34 tgl Exp $
* $Id: trigger.h,v 1.34 2002/04/01 22:36:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -81,6 +81,12 @@ typedef struct TriggerData
* constrname\0fkrel\0pkrel\0matchtype\0fkatt\0pkatt\0fkatt\0pkatt\0...
*
* There are one or more pairs of fkatt/pkatt names.
*
* The relation names are no longer of much use since they are not
* guaranteed unique; they are present only for backwards compatibility.
* Use the tgrelid and tgconstrrelid fields to identify the referenced
* relations, instead. (But note that which is which will depend on which
* trigger you are looking at!)
*/
#define RI_CONSTRAINT_NAME_ARGNO 0
#define RI_FK_RELNAME_ARGNO 1
@ -127,9 +133,8 @@ extern void ExecARUpdateTriggers(EState *estate,
HeapTuple newtuple);
/* ----------
/*
* Deferred trigger stuff
* ----------
*/
typedef struct DeferredTriggerStatusData
{
@ -139,14 +144,12 @@ typedef struct DeferredTriggerStatusData
typedef struct DeferredTriggerStatusData *DeferredTriggerStatus;
typedef struct DeferredTriggerEventItem
{
Oid dti_tgoid;
int32 dti_state;
} DeferredTriggerEventItem;
typedef struct DeferredTriggerEventData *DeferredTriggerEvent;
typedef struct DeferredTriggerEventData
@ -173,7 +176,6 @@ extern void DeferredTriggerSetState(ConstraintsSetStmt *stmt);
/*
* in utils/adt/ri_triggers.c
*
*/
extern bool RI_FKey_keyequal_upd(TriggerData *trigdata);