Re: [PATCHES] As proposed the complete changes to pg_trigger and pg_rewrite

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [PATCHES] As proposed the complete changes to pg_trigger and pg_rewrite
Date: 2007-03-22 13:23:54
Message-ID: 4602836A.1020205@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On 3/21/2007 10:24 PM, Bruce Momjian wrote:
> Ah, so you wait for me to go on vacation to apply it! Well, I am back
> now, buddy. ;-)

Got to use my chances, don't I? :-p

>
> One thing that bothers me about the patch is that it seems you are
> adding functionality that allows you to enable/disable trigger firing in
> groups, which is fine, but you are hard-coding the use of that grouping
> to be replication, e.g. "origin", "replica", etc.
>
> Should these designations be more generic in case there are other uses
> for enabling/disabling groups of triggers?

That would be fine with me, I just wasn't able to come up with any
sensible naming scheme other than replication related. Can you?

Jan

>
> ---------------------------------------------------------------------------
>
> Jan Wieck wrote:
>> For discussion:
>>
>> Attached is the completed patch that changes pg_trigger and extends
>> 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 saved SPI 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.
>>
>> Any volunteers to do the corresponding documentation changes should this
>> patch be accepted?
>>
>

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2007-03-22 13:25:04 Re: CREATE INDEX and HOT - revised design
Previous Message Ivan Zolotukhin 2007-03-22 13:05:52 Re: Google SoC idea: FTS support in GUI tools

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2007-03-22 14:18:55 contrib/spi makefile inconsistency
Previous Message Grzegorz Jaskiewicz 2007-03-22 07:15:09 Re: [PATCHES] Bitmapscan changes