From: Denis <sqllist@coralindia.com>
To: pgsql-odbc@postgresql.org
Subject: Initially Deferred - FK
Date: Thu, 15 Jan 2004 18:34:39 +0530
Message-ID: <00a601c3db68$2845ca50$cb32a8c0@RKCOMPAQ> (raw)
[reSending, ignore if it reached here ealier. Did sent in the morning, but
seems it never reached.]
Hi all,
I am using :
PostgreSQL 7.2.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2
20020903 (Red Hat Linux 8.0 3.2-7)
I am facing strange problem..
I have created two tables:
create table contact (id int constraint contact_pk primary key, name text );
create table address (id int constraint address_fk references contact(id) on
delete cascade initially deferred,
city text,
pin text);
Lets.. insert few data in it..
insert into contact values (1, 'Denis');
insert into contact values (2, 'Anand');
insert into contact values (3, 'Debatosh');
insert into contact values (4, 'Pradeep');
insert into address values (1,'Howrah','711102');
insert into address values (2,'Kolkata','700001');
insert into address values (3,'Jadavpur','700005');
insert into address values (4,'Mumbai','400002');
Now, below gives me the correct result.
select * from contact; select * from address;
acedg=> select * from contact; select * from address;
id | name
----+----------
1 | Denis
2 | Anand
3 | Debatosh
4 | Pradeep
(4 rows)
id | city | pin
----+----------+--------
1 | Howrah | 711102
2 | Kolkata | 700001
3 | Jadavpur | 700005
4 | Mumbai | 400002
(4 rows)
BUT, the problem starts when i issue the following set of DMLs in
transaction:
begin;
delete from contact where id=1;
insert into contact values (1, 'Denis');
delete from address where id=1;
insert into address values (1,'Howrah','711102');
end;
It gives me the result:
acedg=> select * from contact; select * from address;
id | name
----+----------
2 | Anand
3 | Debatosh
4 | Pradeep
1 | Denis
(4 rows)
id | city | pin
----+----------+--------
2 | Kolkata | 700001
3 | Jadavpur | 700005
4 | Mumbai | 400002
(3 rows)
Where is my lastly inserted row ?? i.e.
insert into address values (1,'Howrah','711102');
I have tested the same in ORACLE, and it works fine (i.e. both table has 4
records).
It is BUG or !!!
Pl. help.
Thanx
Denis
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-odbc@postgresql.org
Cc: sqllist@coralindia.com
Subject: Re: Initially Deferred - FK
In-Reply-To: <00a601c3db68$2845ca50$cb32a8c0@RKCOMPAQ>
References: <00a601c3db68$2845ca50$cb32a8c0@RKCOMPAQ>
* 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