The following bug has been logged on the website:

Bug reference:      6531
Logged by:          Claudio Oliveira
Email address:      claudio...@hotmail.com
PostgreSQL version: 9.1.3
Operating system:   windows 7
Description:        

Hello,

It would be a BUG.

Please run by separate blocks for the comment.

One to One Works.

By not blocks.

-----------------------------------------------------------------------

create table mestre (chave serial primary key, descricao varchar(50));

create table detalhe (chave serial primary key, 
                      mestre integer references mestre(chave) ON DELETE
CASCADE, 
                      valor numeric);

CREATE OR REPLACE FUNCTION ftrig_detalhe()
  RETURNS trigger AS
$BODY$
begin
 return null;
end;$BODY$
  LANGUAGE 'plpgsql' VOLATILE;

---------------------------------------------------------------------
insert into mestre (chave, descricao) values (1, 'TESTE');
insert into detalhe (chave, mestre, valor) values (1, 1, 10);
select * from detalhe d left join mestre m on m.chave = d.mestre;
---------------------------------------------------------------------
delete from mestre where chave = 1;
select * from detalhe d left join mestre m on m.chave = d.mestre;
---------------------------------------------------------------------

CREATE TRIGGER tdetalhe
  before DELETE
  ON detalhe
  FOR EACH ROW
  EXECUTE PROCEDURE ftrig_detalhe();

---------------------------------------------------------------------
insert into mestre (chave, descricao) values (1, 'TESTE');
insert into detalhe (chave, mestre, valor) values (1, 1, 10);
select * from detalhe d left join mestre m on m.chave = d.mestre;
---------------------------------------------------------------------
delete from mestre where chave = 1;
select * from detalhe d left join mestre m on m.chave = d.mestre;
---------------------------------------------------------------------


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to