Thu Jan 14 01:48:29 PST 2016
- Previous message: [Slony1-general] log insert/update query executed on subscriber
- Next message: [Slony1-general] log insert/update query executed on subscriber
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 13.01.2016 09:17, Stéphane Schildknecht wrote:
> On 13/01/2016 07:52, 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
>> # 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?
>>
> I guess it is related to the alphabetical order of triggers, as they are both
> BEFORE triggers.
>
Yes, it's true. Quote from documentation:
"If multiple triggers of the same kind are defined for the same event,
they will be fired in alphabetical order by name".
So I named this trigger __audit. That is first in alphabetical order but
it seems not working well.
- Previous message: [Slony1-general] log insert/update query executed on subscriber
- Next message: [Slony1-general] log insert/update query executed on subscriber
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list