Received: from interlock2.lexmark.com (interlock2.lexmark.com [192.146.101.10]) by postgresql.org (8.11.3/8.11.1) with SMTP id f6QKaEf08926 for ; Thu, 26 Jul 2001 16:36:14 -0400 (EDT) (envelope-from wsheldah@lexmark.com) Received: by interlock2.lexmark.com id QAA24005 (InterLock SMTP Gateway 4.2 for pgsql-general@postgresql.org); Thu, 26 Jul 2001 16:36:08 -0400 Message-Id: <200107262036.QAA24005@interlock2.lexmark.com> Received: by interlock2.lexmark.com (Protected-side Proxy Mail Agent-2); Thu, 26 Jul 2001 16:36:08 -0400 Received: by interlock2.lexmark.com (Protected-side Proxy Mail Agent-1); Thu, 26 Jul 2001 16:36:08 -0400 X-Lotus-Fromdomain: LEXMARK@LEXMTA From: wsheldah@lexmark.com To: "Steve SAUTETNER" Cc: pgsql-general@postgresql.org Date: Thu, 26 Jul 2001 11:24:05 -0400 Subject: Re: concurent updates Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-Archive-Number: 200107/951 X-Sequence-Number: 13071 Why do you need to change the value of the id field?? The id field shouldn't have any meaning attached to it beyond the fact that it uniquely identifies a row in the table, and of course its usage as a foreign key when it serves that role. If you just want to change what numbers get assigned, I think you can update the SEQUENCE that table1 uses. If you really need to do this, you might have better luck using a trigger to do a cascading update from table1 to table2, and then ONLY issue the update to table1, counting on the trigger to update table2. "Steve SAUTETNER" on 07/26/2001 05:19:36 AM To: pgsql-general%postgresql.org@interlock.lexmark.com cc: (bcc: Wesley Sheldahl/Lex/Lexmark) Subject: [GENERAL] concurent updates hi everybody ! I've got a little problem when updating a primary key in two table where the primary key of the one is a foreign key from the second : here are the 2 tables : create table table1 (id int primary key, col1 int); create table table2 (id int primary key references table1(id), col2 int); and the 2 updates : 1) update table2 set id = 1001 where id = 1; 2) update table1 set id = 1001 where id = 1; i can't execute them separately because of an integrity constraint violation. i've got the same error in a BEGIN / COMMIT block containing the updates. Does any one see how two help me ? thanks. ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)