diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-12-11 19:28:31 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-12-11 19:28:31 -0500 |
commit | cd3413ec3683918c9cb9cfb39ae5b2c32f231e8b (patch) | |
tree | d1cb0ff4a854646f9fb8b7b4c31cbd20aa124b0b /src | |
parent | b19e4250b45e91c9cbdd18d35ea6391ab5961c8d (diff) | |
download | postgresql-cd3413ec3683918c9cb9cfb39ae5b2c32f231e8b.tar.gz postgresql-cd3413ec3683918c9cb9cfb39ae5b2c32f231e8b.zip |
Disable event triggers in standalone mode.
Per discussion, this seems necessary to allow recovery from broken event
triggers, or broken indexes on pg_event_trigger.
Dimitri Fontaine
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/event_trigger.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c index cb4e658a584..1edffee410e 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -567,6 +567,25 @@ EventTriggerDDLCommandStart(Node *parsetree) EventTriggerData trigdata; /* + * Event Triggers are completely disabled in standalone mode. There are + * (at least) two reasons for this: + * + * 1. A sufficiently broken event trigger might not only render the + * database unusable, but prevent disabling itself to fix the situation. + * In this scenario, restarting in standalone mode provides an escape + * hatch. + * + * 2. BuildEventTriggerCache relies on systable_beginscan_ordered, and + * therefore will malfunction if pg_event_trigger's indexes are damaged. + * To allow recovery from a damaged index, we need some operating mode + * wherein event triggers are disabled. (Or we could implement + * heapscan-and-sort logic for that case, but having disaster recovery + * scenarios depend on code that's otherwise untested isn't appetizing.) + */ + if (!IsUnderPostmaster) + return; + + /* * We want the list of command tags for which this procedure is actually * invoked to match up exactly with the list that CREATE EVENT TRIGGER * accepts. This debugging cross-check will throw an error if this |