pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: claudiomsi@hotmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6531: integrity constraint failure
Date: Wed, 14 Mar 2012 16:07:00 +0000
Message-ID: <E1S7qj6-000148-7H@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      6531
Logged by:          Claudio Oliveira
Email address:      claudiomsi@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;
---------------------------------------------------------------------




view thread (2+ messages)  latest in thread

Message-ID: <E1S7qj6-000148-7H@wrigleys.postgresql.org>
Permalink:  ../E1S7qj6-000148-7H@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1S7qj6-000148-7H@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: claudiomsi@hotmail.com
  Subject: Re: BUG #6531: integrity constraint failure
  In-Reply-To: <E1S7qj6-000148-7H@wrigleys.postgresql.org>
  References: <E1S7qj6-000148-7H@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox