From: | wieck(at)postgresql(dot)org (Jan Wieck) |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Changes pg_trigger and extend pg_rewrite in order to allow |
Date: | 2007-03-19 23:38:32 |
Message-ID: | 20070319233832.A86D39FB32B@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Log Message:
-----------
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
Modified Files:
--------------
pgsql/doc/src/sgml:
catalogs.sgml (r2.145 -> r2.146)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/catalogs.sgml.diff?r1=2.145&r2=2.146)
config.sgml (r1.115 -> r1.116)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/config.sgml.diff?r1=1.115&r2=1.116)
pgsql/doc/src/sgml/ref:
alter_table.sgml (r1.94 -> r1.95)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/alter_table.sgml.diff?r1=1.94&r2=1.95)
pgsql/src/backend/commands:
tablecmds.c (r1.217 -> r1.218)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c.diff?r1=1.217&r2=1.218)
trigger.c (r1.213 -> r1.214)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/trigger.c.diff?r1=1.213&r2=1.214)
pgsql/src/backend/parser:
gram.y (r2.582 -> r2.583)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/gram.y.diff?r1=2.582&r2=2.583)
keywords.c (r1.184 -> r1.185)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/keywords.c.diff?r1=1.184&r2=1.185)
pgsql/src/backend/rewrite:
rewriteDefine.c (r1.118 -> r1.119)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/rewrite/rewriteDefine.c.diff?r1=1.118&r2=1.119)
rewriteHandler.c (r1.172 -> r1.173)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/rewrite/rewriteHandler.c.diff?r1=1.172&r2=1.173)
pgsql/src/backend/utils/cache:
plancache.c (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/plancache.c.diff?r1=1.2&r2=1.3)
relcache.c (r1.257 -> r1.258)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/relcache.c.diff?r1=1.257&r2=1.258)
pgsql/src/backend/utils/misc:
guc.c (r1.382 -> r1.383)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/misc/guc.c.diff?r1=1.382&r2=1.383)
postgresql.conf.sample (r1.212 -> r1.213)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/misc/postgresql.conf.sample.diff?r1=1.212&r2=1.213)
pgsql/src/bin/pg_dump:
pg_dump.c (r1.460 -> r1.461)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_dump.c.diff?r1=1.460&r2=1.461)
pg_dump.h (r1.133 -> r1.134)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_dump.h.diff?r1=1.133&r2=1.134)
pgsql/src/bin/psql:
describe.c (r1.154 -> r1.155)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/describe.c.diff?r1=1.154&r2=1.155)
pgsql/src/include/catalog:
pg_rewrite.h (r1.27 -> r1.28)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_rewrite.h.diff?r1=1.27&r2=1.28)
pg_trigger.h (r1.27 -> r1.28)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_trigger.h.diff?r1=1.27&r2=1.28)
pgsql/src/include/commands:
trigger.h (r1.61 -> r1.62)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/trigger.h.diff?r1=1.61&r2=1.62)
pgsql/src/include/nodes:
parsenodes.h (r1.342 -> r1.343)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h.diff?r1=1.342&r2=1.343)
pgsql/src/include/rewrite:
prs2lock.h (r1.22 -> r1.23)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/rewrite/prs2lock.h.diff?r1=1.22&r2=1.23)
rewriteDefine.h (r1.24 -> r1.25)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/rewrite/rewriteDefine.h.diff?r1=1.24&r2=1.25)
pgsql/src/include/utils:
plancache.h (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/plancache.h.diff?r1=1.2&r2=1.3)
rel.h (r1.98 -> r1.99)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/rel.h.diff?r1=1.98&r2=1.99)
From | Date | Subject | |
---|---|---|---|
Next Message | User Eggyknap | 2007-03-20 00:22:26 | pgsnmpd - pgsnmpd: Finish RDBMS-MIB::rdbmsDbParamTable (finally!) |
Previous Message | User Ecarver | 2007-03-19 23:17:21 | bizgres - bizgres: |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-03-20 00:33:31 | Re: modifying the tbale function |
Previous Message | Florian G. Pflug | 2007-03-19 23:27:08 | Re: modifying the tbale function |