X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8FDCBD1B47D for ; Fri, 16 Jan 2004 04:32:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 52136-03 for ; Fri, 16 Jan 2004 00:32:25 -0400 (AST) Received: from ns.tirupati.biz (unknown [64.239.5.38]) by svr1.postgresql.org (Postfix) with SMTP id 5ADD0D1D576 for ; Fri, 16 Jan 2004 00:32:24 -0400 (AST) Received: (qmail 19924 invoked from network); 16 Jan 2004 05:31:21 -0000 Received: from softdnserror (HELO server2k) (61.11.69.59) by ns.tirupati.biz with SMTP; 16 Jan 2004 05:31:21 -0000 Received: from 192.168.50.15 by server2k ([192.168.50.102] running VPOP3) with SMTP for ; Fri, 16 Jan 2004 10:07:49 +0530 X-MSReally-From: sqllist@coralindia.com Message-ID: <006601c3dbea$02295800$0f32a8c0@denisnew> From: "Denis" To: Subject: Initially Deffered - FK Date: Fri, 16 Jan 2004 10:04:18 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Server: VPOP3 V1.5.0 - Registered X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200401/133 X-Sequence-Number: 16526 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; /* this is not required.. but my app.fires. Should not have any impact */ 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