mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Clean up some minor problems exposed by further thought about Panon's bug
report on old-style functions invoked by RI triggers. We had a number of other places that were being sloppy about which memory context FmgrInfo subsidiary data will be allocated in. Turns out none of them actually cause a problem in 7.1, but this is for arcane reasons such as the fact that old-style triggers aren't supported anyway. To avoid getting burnt later, I've restructured the trigger support so that we don't keep trigger FmgrInfo structs in relcache memory. Some other related cleanups too: it's not really necessary to call fmgr_info at all while setting up the index support info in relcache entries, because those ScanKeyEntry structs are never used to invoke the functions. This should speed up relcache initialization a tiny bit.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: rel.h,v 1.45 2001/03/22 04:01:14 momjian Exp $
|
||||
* $Id: rel.h,v 1.46 2001/06/01 02:41:36 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -47,13 +47,11 @@ typedef LockInfoData *LockInfo;
|
||||
* Likewise, this struct really belongs to trigger.h, but for convenience
|
||||
* we put it here.
|
||||
*/
|
||||
|
||||
typedef struct Trigger
|
||||
{
|
||||
Oid tgoid;
|
||||
char *tgname;
|
||||
Oid tgfoid;
|
||||
FmgrInfo tgfunc;
|
||||
int16 tgtype;
|
||||
bool tgenabled;
|
||||
bool tgisconstraint;
|
||||
@@ -66,16 +64,23 @@ typedef struct Trigger
|
||||
|
||||
typedef struct TriggerDesc
|
||||
{
|
||||
/* index data to identify which triggers are which */
|
||||
uint16 n_before_statement[4];
|
||||
uint16 n_before_row[4];
|
||||
uint16 n_after_row[4];
|
||||
uint16 n_after_statement[4];
|
||||
Trigger **tg_before_statement[4];
|
||||
Trigger **tg_before_row[4];
|
||||
Trigger **tg_after_row[4];
|
||||
Trigger **tg_after_statement[4];
|
||||
/* the actual array of triggers is here */
|
||||
/*
|
||||
* Index data to identify which triggers are which. Since each trigger
|
||||
* can appear in more than one class, for each class we provide a list
|
||||
* of integer indexes into the triggers array.
|
||||
*/
|
||||
#define TRIGGER_NUM_EVENT_CLASSES 4
|
||||
|
||||
uint16 n_before_statement[TRIGGER_NUM_EVENT_CLASSES];
|
||||
uint16 n_before_row[TRIGGER_NUM_EVENT_CLASSES];
|
||||
uint16 n_after_row[TRIGGER_NUM_EVENT_CLASSES];
|
||||
uint16 n_after_statement[TRIGGER_NUM_EVENT_CLASSES];
|
||||
int *tg_before_statement[TRIGGER_NUM_EVENT_CLASSES];
|
||||
int *tg_before_row[TRIGGER_NUM_EVENT_CLASSES];
|
||||
int *tg_after_row[TRIGGER_NUM_EVENT_CLASSES];
|
||||
int *tg_after_statement[TRIGGER_NUM_EVENT_CLASSES];
|
||||
|
||||
/* The actual array of triggers is here */
|
||||
Trigger *triggers;
|
||||
int numtriggers;
|
||||
} TriggerDesc;
|
||||
|
||||
Reference in New Issue
Block a user