|
Home > Archive > Slony1 PostgreSQL Replication > April 2006 > about triggers in slave db
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
about triggers in slave db
|
|
| Miguel 2006-04-05, 8:28 pm |
| hi , i have many triggers in accounting tables that modifies varius
columns in other diferent tables, what will happend with this triggers
in the slave database, i. .e: when i insert data in traffic table in
master db, the trigger in traffic table makes some calculations and
updates h323-credit-amount column in users table, slony will replicate
this insert and update, so far so good.
_but_ in the slave db the trigger will be fired again, isnt it?, if so,
the trigger will do calculations for the same inserted row and it will
update the h323-credit-amount column again?
i hope not...
---
Miguel
| |
| Alan Hodgson 2006-04-05, 8:28 pm |
| On April 5, 2006 03:32 pm, Miguel <mmiranda- nEhLOg9Nx0turzwRxvvF
aw@public.gmane.org> wrote:
> _but_ in the slave db the trigger will be fired again, isnt it?, if so,
> the trigger will do calculations for the same inserted row and it will
> update the h323-credit-amount column again?
Existing triggers are removed from the tables on the slaves.
--
Alan
| |
| cbbrowne-swQf4SbcV9C7WVzo/KQ3Mw@public.gmane.org 2006-04-06, 3:28 am |
| > On April 5, 2006 03:32 pm, Miguel <mmiranda- nEhLOg9Nx0turzwRxvvF
aw@public.gmane.org> wrote:
>
> Existing triggers are removed from the tables on the slaves.
That's not exactly correct.
The triggers are modified to point them to the primary key index, which
deactivates them.
| |
| cbbrowne-swQf4SbcV9C7WVzo/KQ3Mw@public.gmane.org 2006-04-06, 3:28 am |
| > hi , i have many triggers in accounting tables that modifies varius
> columns in other diferent tables, what will happend with this triggers
> in the slave database, i. .e: when i insert data in traffic table in
> master db, the trigger in traffic table makes some calculations and
> updates h323-credit-amount column in users table, slony will replicate
> this insert and update, so far so good.
> _but_ in the slave db the trigger will be fired again, isnt it?, if so,
> the trigger will do calculations for the same inserted row and it will
> update the h323-credit-amount column again?
> i hope not...
"Not" is normally the case.
Triggers are deactivated on subscriber nodes. That will cover your case,
as well as foreign key triggers which, once satisfied on the origin, do
not need to be verified again.
If you need triggers to run on subscriber nodes, there is a STORE TRIGGER
command in Slonik to allow that...
| |
| Alan Hodgson 2006-04-06, 3:28 am |
| On April 5, 2006 07:45 pm, cbbrowne-swQf4SbcV9C7WVzo/KQ3Mw@public.gmane.org wrote:
> That's not exactly correct.
>
> The triggers are modified to point them to the primary key index, which
> deactivates them.
Well, yes. For the purposes that the OP was worried about, they are removed
_from the table_.
For "be careful with future DDL or you'll screw up your database due to
where the foreign keys are hidden" reasons, I should be more precise.
Thank you.
--
Alan
| |
| Miguel 2006-04-06, 3:28 am |
| cbbrowne-swQf4SbcV9C7WVzo/KQ3Mw@public.gmane.org wrote:
>
>"Not" is normally the case.
>
>Triggers are deactivated on subscriber nodes. That will cover your case,
>as well as foreign key triggers which, once satisfied on the origin, do
>not need to be verified again.
>
>If you need triggers to run on subscriber nodes, there is a STORE TRIGGER
>command in Slonik to allow that...
>
>
It will cover my case, yes, i dont need triggers on subscribers, i
just wanted to be sure nothing "strange" could happen to my
customers' credit-amount, but its good to know what to do if i want
to, great work,
thanks
---
Miguel
>
>
>
|
|
|
|
|