Christopher Browne cbbrowne at ca.afilias.info
Mon Oct 5 15:37:27 PDT 2009
Vick Khera <vivek at khera.org> writes:
> On Mon, Oct 5, 2009 at 11:10 AM, Andrew Sullivan <ajs at crankycanuck.ca> wrote:
>> On Mon, Oct 05, 2009 at 11:01:03AM -0400, Vick Khera wrote:
>>>
>>> Does that create table command need to be run via EXECUTE SCRIPT in
>>> slony1?
>>
>> I believe it does,
>>
>>> technically modifies the target table by adding an internal trigger,
>>
>> for exactly this reason.
>>
>
> I'll be revising our internal procedural documentation forthwith.
> Thanks for your response.

In 2.0, I *think* it doesn't matter.

- If the table has no connection to a replicated table, then it
  shouldn't matter at all.

- If the table is a replicated table, then you know you need to add it
  to replication, and the "set add table" process will be rummaging at
  that table on all nodes in pretty predictable ways.

  In any case, you'd not be asking this about a table you're planning
  to replicate :-).

The third possibility...

- The table is not replicated, but has a FK reference to a replicated
  table.

  In this case, creating the table establishes a trigger against the
  replicated table to check references to the new table.

  Two possibilities:

  a) On the origin...

  The trigger needs to fire.  And it will...

  b) On a subscriber...

  The trigger shouldn't fire, because the replicated table isn't
  authoritative here.

  The slon runs in "replica" mode, which suppresses normally-created
  triggers.

I'm pretty sure that it doesn't matter whether or not you run CREATE
TABLE via EXECUTE SCRIPT.  

With Slony-I 2.0, regular triggers aren't modified; they're just
suppressed.  And they're suppressed irrespective of how you run CREATE
TABLE.

Establishing the table via CREATE TABLE feeds into the "hygenic"
matter of whether you're managing schema in a consistent way, but from
a "does the trigger fiddling get handled right?" perspective, it's
fine for you to use EXECUTE SCRIPT or not, at your choice.
-- 
(reverse (concatenate 'string "ofni.sailifa.ac" "@" "enworbbc"))
Christopher Browne
"Bother,"  said Pooh,  "Eeyore, ready  two photon  torpedoes  and lock
phasers on the Heffalump, Piglet, meet me in transporter room three"


More information about the Slony1-general mailing list