Article View: borland.public.interbase.replication
Article #6Re: Changing primary key and replicate this value
From: Bill Todd (TeamB)
Date: Fri, 20 Feb 2004 18:02
Date: Fri, 20 Feb 2004 18:02
27 lines
2360 bytes
2360 bytes
On Fri, 20 Feb 2004 11:12:14 +0100, "David Domingo" <david.domingo@starseguridad.com> wrote: >Then, what is the purpose of foreign keys with update cascade? ;) The purpose is to allow you to use an unstable attribute for the primary key. This does not make it a good idea. As you have already discovered, an unstable primary key makes replication very difficult. Unstable primary keys also cause concurrency problems. Suppose you have a table with an unstable key and this table has a one-to-many relationship with a table that has the cascade update option for its foreign key. One user changes the primary key value in the master table. Another user has changed one of the detail records and has not committed yet. Since one of the detail records is locked the primary key change cannot be cascaded. Depending on the transaction options of the user trying to change the primary key he/she will either get an error or hang until the user changing the detail record either commits or rolls back. Stability is second only to uniqueness in importance when choosing a primary key. If there is no attribute or combination of attributes that is both unique and stable use a surrogate primary key. You will save yourself a lot of headaches. -- Bill (TeamB) (TeamB cannot respond to questions received via email)
Technical Details
Message-ID:
<mcic30d6avuml13ilsuokrerfncilfpjtu@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4034dce9$1@newsgroups.borland.com> <4034e8dc$1@newsgroups.borland.com> <4035deb9$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f89d7,2f886c55ebe3c509 X-Google-Attributes: gidf89d7,public X-Google-ArrivalTime: 2004-02-20 10:09:56 PST From: "Bill Todd (TeamB)" <no@no.com> Newsgroups: borland.public.interbase.replication Subject: Re: Changing primary key and replicate this value Date: Fri, 20 Feb 2004 11:02:21 -0700 Message-ID: <mcic30d6avuml13ilsuokrerfncilfpjtu@4ax.com> References: <4034dce9$1@newsgroups.borland.com> <4034e8dc$1@newsgroups.borland.com> <4035deb9$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 216.207.213.29 X-Trace: newsgroups.borland.com 1077300141 216.207.213.29 (20 Feb 2004 10:02:21 -0800) Lines: 27 X-Authenticated-User: btodd Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail