Steve Singer ssinger at ca.afilias.info
Wed Jan 13 14:37:24 PST 2016
On 01/13/2016 01:52 AM, Krzysztof Jakowczyk wrote:
> No, it doesn't. Take a look:
>
> # \d emp
>        Table "public.emp"
>   Column  |  Type   | Modifiers
> ---------+---------+-----------
>   empname | text    | not null
>   salary  | integer |
> Triggers:
>      _b24v2_denyaccess BEFORE INSERT OR DELETE OR UPDATE ON emp FOR EACH
> ROW EXECUTE PROCEDURE _b24v2.denyaccess('_b24v2')
> Triggers firing always:
>      __audit BEFORE INSERT OR DELETE OR UPDATE ON emp FOR EACH ROW
> EXECUTE PROCEDURE save_query()
>
>
> -- with disabled trigger denyaccess
> # insert into emp values ('TEST dasdasdas',123123);
> INSERT 0 1
> # select * from audit.slon_audit;
>   operation |           stamp            |  userid
> |                       query
> -----------+----------------------------+----------+---------------------------------------------------
>   I         | 2016-01-13 06:46:15.417799 | postgres | insert into emp
> values ('TEST dasdasdas',123123);
> (1 row)
>
> -- enabling trigger denyaccess
> # alter table emp enable trigger _b24v2_denyaccess;
> ALTER TABLE
> # insert into emp values ('test2',31337);
> ERROR:  Slony-I: Table emp is replicated and cannot be modified on a
> subscriber node - role=0

I guess I don't understand what it is your trying to do.

What I thought you were asking was this

You have the table "emp" which has node1 as the origin.

You replicate the table "emp" to node 2.

You have the audit.slon_audit table on both node1 and node2. You want 
the trigger to fire on both node1 and node2 instead of replicating 
audit.slon_audit

If that's the case why are you trying your insert on node2?
You want to perform the insert on node1,and then the audit trigger 
should run (assuming you configure it as an always trigger) on both 
node1 and on node2 inserting data into your audit table





> # select * from audit.slon_audit;
>   operation |           stamp            |  userid
> |                       query
> -----------+----------------------------+----------+---------------------------------------------------
>   I         | 2016-01-13 06:46:15.417799 | postgres | insert into emp
> values ('TEST dasdasdas',123123);
> (1 row)
>
>
> Nothing happend. Any other ideas?
>



More information about the Slony1-general mailing list