Our java aplication have bug and from time to time it's trying to insert
row on subscriber node (which shouldn't happend). My developers wants to
have query with parametrs which is executed on subscriber node. Table
audit.slon_audit is created only on subscriber node to catch "bad"
INSERT/UPDATE queries. I know that this queries shoud executed only on
origin. I want to find the cause of this behavior of our aplication.


On 13.01.2016 23:37, Steve Singer wrote:
> 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?
>>
>
> .
>


_______________________________________________
Slony1-general mailing list
Slony1-general@lists.slony.info
http://lists.slony.info/mailman/listinfo/slony1-general

Reply via email to