Bug in pgadmin III v 1.12.2
От | Dan S |
---|---|
Тема | Bug in pgadmin III v 1.12.2 |
Дата | |
Msg-id | AANLkTinbujGBqqtBh3v55p3OJJHQ91Nneb552B7ZJ7UJ@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Bug in pgadmin III v 1.12.2
|
Список | pgadmin-support |
Hi !<br /><br />I'm running pgadmin v. 1.12.2 on winxp and postgres "PostgreSQL 9.0.2, compiled by Visual C++ build 1500,32-bit".<br /><br />When selecting a table in the tree-navigator to the left the table definition and its triggers appearsto the right.<br /> However the trigger definition doesn't appear to be right ( a constraint trigger appears as anordinary trigger ).<br /><br />To reproduce:<br /><br />create the table and trigger below then refresh the table definitionin pgadmin and look at the trigger.<br /> It is not shown as a constraint trigger !<br /><br />create table tst(txn_id int primary key, amount numeric(15,2));<br /><br />create or replace function def_constr_tst_chk_balance()<br/>returns trigger as<br />$$<br />declare<br /> v_amount numeric(15,2);<br /> begin<br/> if (tg_op='INSERT') then<br /> select sum(amount)<br /> into v_amount<br /> from tst;<br/><br /> if (v_amount<>0) then<br /> raise exception 'error: sum does not balance';<br /> end if;<br /> return new;<br /> end if;<br /> raise exception 'only allowed to insert';<br />end;<br/>$$<br />language plpgsql;<br /><br />create constraint trigger tst_constraint<br />after insert or update or delete<br/> on tst<br />deferrable initially deferred<br />for each row<br />execute procedure def_constr_tst_chk_balance();<br/><br />-- should succeed on commit<br />begin transaction;<br />insert into tst values(1,100);<br/>insert into tst values(2,-100);<br /> commit transaction;<br /><br />-- should fail on commit<br />begintransaction;<br />insert into tst values(3,100);<br />insert into tst values(4,-110);<br />commit transaction;<br/><br /><br />Best Regards<br />Dan S<br />
В списке pgadmin-support по дате отправления: