postgresql/src/backend/commands
Jan Wieck 0fe16500d3 Changes pg_trigger and extend pg_rewrite in order to allow triggers and
rules to be defined with different, per session controllable, behaviors
for replication purposes.

This will allow replication systems like Slony-I and, as has been stated
on pgsql-hackers, other products to control the firing mechanism of
triggers and rewrite rules without modifying the system catalog directly.

The firing mechanisms are controlled by a new superuser-only GUC
variable, session_replication_role, together with a change to
pg_trigger.tgenabled and a new column pg_rewrite.ev_enabled. Both
columns are a single char data type now (tgenabled was a bool before).
The possible values in these attributes are:

     'O' - Trigger/Rule fires when session_replication_role is "origin"
           (default) or "local". This is the default behavior.

     'D' - Trigger/Rule is disabled and fires never

     'A' - Trigger/Rule fires always regardless of the setting of
           session_replication_role

     'R' - Trigger/Rule fires when session_replication_role is "replica"

The GUC variable can only be changed as long as the system does not have
any cached query plans. This will prevent changing the session role and
accidentally executing stored procedures or functions that have plans
cached that expand to the wrong query set due to differences in the rule
firing semantics.

The SQL syntax for changing a triggers/rules firing semantics is

     ALTER TABLE <tabname> <when> TRIGGER|RULE <name>;

     <when> ::= ENABLE | ENABLE ALWAYS | ENABLE REPLICA | DISABLE

psql's \d command as well as pg_dump are extended in a backward
compatible fashion.

Jan
2007-03-19 23:38:32 +00:00
..
Makefile Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
aggregatecmds.c Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
alter.c Add CREATE/ALTER/DROP OPERATOR FAMILY commands, also COMMENT ON OPERATOR 2007-01-23 05:07:18 +00:00
analyze.c Support ORDER BY ... NULLS FIRST/LAST, and add ASC/DESC/NULLS FIRST/NULLS LAST 2007-01-09 02:14:16 +00:00
async.c Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
cluster.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
comment.c Wording cleanup for error messages. Also change can't -> cannot. 2007-02-01 19:10:30 +00:00
conversioncmds.c Fix up foreign-key mechanism so that there is a sound semantic basis for the 2007-02-14 01:58:58 +00:00
copy.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
dbcommands.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
define.c Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
explain.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
functioncmds.c Add COST and ROWS options to CREATE/ALTER FUNCTION, plus underlying pg_proc 2007-01-22 01:35:23 +00:00
indexcmds.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
lockcmds.c Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
opclasscmds.c Wording cleanup for error messages. Also change can't -> cannot. 2007-02-01 19:10:30 +00:00
operatorcmds.c Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
portalcmds.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
prepare.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
proclang.c Add COST and ROWS options to CREATE/ALTER FUNCTION, plus underlying pg_proc 2007-01-22 01:35:23 +00:00
schemacmds.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
sequence.c Wording cleanup for error messages. Also change can't -> cannot. 2007-02-01 19:10:30 +00:00
tablecmds.c Changes pg_trigger and extend pg_rewrite in order to allow triggers and 2007-03-19 23:38:32 +00:00
tablespace.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
trigger.c Changes pg_trigger and extend pg_rewrite in order to allow triggers and 2007-03-19 23:38:32 +00:00
typecmds.c Fix up foreign-key mechanism so that there is a sound semantic basis for the 2007-02-14 01:58:58 +00:00
user.c Wording cleanup for error messages. Also change can't -> cannot. 2007-02-01 19:10:30 +00:00
vacuum.c Fix a longstanding bug in VACUUM FULL's handling of update chains. The code 2007-03-14 18:48:55 +00:00
vacuumlazy.c Update new optional VACUUM FULL hint for translations, per Alvaro. 2007-02-21 22:47:45 +00:00
variable.c Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
view.c First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00