Re: [BUGS] BUG #13632: violation de l'intégrité référentielle

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [BUGS] BUG #13632: violation de l'intégrité référentielle
Дата
Msg-id CAKFQuwYsAaXxYGCVN7xgCMVBQuzfGu_hHkVz-twZEpsF4OMA_Q@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #13632: violation de l'intégrité référentielle  (allhassane@yahoo.fr)
Список 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 по дате отправления:

Предыдущее
От: andreas-postgresql@creative-memory.de
Дата:
Сообщение: BUG #13633: ERROR: invalid memory alloc request size
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #13633: ERROR: invalid memory alloc request size