Re: [BUGS] BUG #13632: violation de l'intégrité référentielle - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: [BUGS] BUG #13632: violation de l'intégrité référentielle
Date
Msg-id CAKFQuwYsAaXxYGCVN7xgCMVBQuzfGu_hHkVz-twZEpsF4OMA_Q@mail.gmail.com
Whole thread Raw
In response to BUG #13632: violation de l'intégrité référentielle  (allhassane@yahoo.fr)
List pgsql-bugs
On Tuesday, September 22, 2015, <allhassane@yahoo.fr> wrote:
The following bug has been logged on the website:

Bug reference:      13632
Logged by:          Alassane Diakité
Email address:      allhassane@yahoo.fr
PostgreSQL version: 9.4.4
Operating system:   windows
Description:

Salut
La situation...
Les tables tm et tf (tf liée à tm par une intégrité référentielle)
[code]create table tm(idm serial not null primary key, vm varchar);
create table tf(idf serial not null primary key, idm int not null references
tm(idm) on delete cascade, vf varchar);[/code]
Un fonction trigger qui annule la suppression dans tf
[code]
--le trigger
create function tgtf() returns trigger
as
$$
begin
return null;
end
$$ language plpgsql

--liaison à tf
create trigger tgf before delete on tf
 FOR EACH ROW
  EXECUTE PROCEDURE tgtf();
[/code]
insertion de données dans tm et tf
[code]insert into tm(vm) values('a'),('b'),('c');
insert into tf(idm, vf) values(1, 'a1'),(1, 'a2'), (2, 'b1'), (2, 'b2'),(3,
'c1'),(3, 'c2');[/code]
suppression d'une ligne de tm
[code]delete from tm where idm=1;[/code]
la jointure gauche
[code]select tf.idm, tf.vf, tm.idm from tf left join tm on
tf.idm=tm.idm;[/code]
idm      vf    idm
1        a1     null
1        a2     null
2        b1     2
2        b2     2
3        c1     3
3        c2     3

Qu'en dites-vous?
J'avais une fois remarqué qu'une des mes bd présentait ce problème
(violation d'intégrité référentielle) sans que je ne sache comment c'est
arrivé. Maintenant que j'ai reproduit la situation, je veux comprendre le
problème.
@+



Working as designed.


Returning null is not that useful an action.

David J.

pgsql-bugs by date:

Previous
From: andreas-postgresql@creative-memory.de
Date:
Subject: BUG #13633: ERROR: invalid memory alloc request size
Next
From: Tom Lane
Date:
Subject: Re: BUG #13633: ERROR: invalid memory alloc request size