From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | "allhassane(at)yahoo(dot)fr" <allhassane(at)yahoo(dot)fr> |
Cc: | "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: [BUGS] BUG #13632: violation de l'intégrité référentielle |
Date: | 2015-09-22 15:56:53 |
Message-ID: | CAKFQuwYsAaXxYGCVN7xgCMVBQuzfGu_hHkVz-twZEpsF4OMA_Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tuesday, September 22, 2015, <allhassane(at)yahoo(dot)fr> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 13632
> Logged by: Alassane Diakité
> Email address: allhassane(at)yahoo(dot)fr <javascript:;>
> 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.
http://www.postgresql.org/docs/9.3/interactive/trigger-definition.html
Returning null is not that useful an action.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-09-22 16:48:40 | Re: BUG #13633: ERROR: invalid memory alloc request size |
Previous Message | andreas-postgresql | 2015-09-22 14:52:49 | BUG #13633: ERROR: invalid memory alloc request size |