hi, there!
If I have two tables, first with primary key, second references to first
and in one transaction I insert row in any of these tables and when try to
delete it, I receive :
ERROR: triggered data change violation on relation 'xxx'
Here is an example:
temp=# CREATE TABLE prim (i int primary key);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'prim_pkey'
for table 'prim'
CREATE
temp=# create table fore (j int references prim);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
CREATE
temp=# insert into prim values(1);
INSERT 85836 1
temp=# begin;
BEGIN
temp=# INSERT INTO fore values (1);
INSERT 85837 1
temp=# delete from fore;
ERROR: triggered data change violation on relation "fore"
temp=# rollback;
ROLLBACK
temp=# begin;
BEGIN
temp=# INSERT INTO prim VALUES (2);
INSERT 85880 1
temp=# DELETE from prim where i = 2;
ERROR: triggered data change violation on relation "prim"
temp=# rollback;
ROLLBACK
temp=# select version(); version
-------------------------------------------------------------PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC
2.96
(1 row)
/Constantin