From: allhassane@yahoo.fr
To: pgsql-bugs@postgresql.org
Subject: BUG #13632: violation de l'intégrité référentielle
Date: Tue, 22 Sep 2015 13:44:04 +0000
Message-ID: <20150922134404.5050.75087@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
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.
@+
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: allhassane@yahoo.fr
Subject: Re: BUG #13632: violation de l'intégrité référentielle
In-Reply-To: <20150922134404.5050.75087@wrigleys.postgresql.org>
References: <20150922134404.5050.75087@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