Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Stuart McGraw
Glenn Maynard wrote: (JMdict? yup. ;-) I was playing with importing that into a DB a while back, but the attributes in that XML are such a pain--and then my email died while I was trying to get those changed, and I never picked it up again.) On Mon, Apr 13, 2009 at 1:20 PM, Stuart McGraw

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Glenn Maynard
On Mon, Apr 13, 2009 at 5:43 PM, Richard Broersma wrote: > From what I've seen, this problem can affect both surrogate and > natural key designs.  In both cases, care must be taken to ensure that > an underling tuple hasn't been changed by any other clients before it > attempts to commit its chang

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Richard Broersma
On Mon, Apr 13, 2009 at 2:32 PM, Glenn Maynard wrote: > If your senses are reordered by someone else, and > you operate on /10/3, you may suddenly find yourself viewing or > modifying (or deleting!) a different sense.  This could even happen > within the same transaction, if you're not very caref

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Glenn Maynard
On Mon, Apr 13, 2009 at 5:18 PM, Richard Broersma wrote: >> Your PK is a composite of (entry, order)?  Won't your foreign keys >> elsewhere all break when you shift the order around? > > If there really are foreign keys, then an update will not be allowed > to shift a primary key unless the foreig

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Richard Broersma
On Mon, Apr 13, 2009 at 2:09 PM, Glenn Maynard wrote: > Your PK is a composite of (entry, order)?  Won't your foreign keys > elsewhere all break when you shift the order around? If there really are foreign keys, then an update will not be allowed to shift a primary key unless the foreign key is

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Glenn Maynard
(JMdict? I was playing with importing that into a DB a while back, but the attributes in that XML are such a pain--and then my email died while I was trying to get those changed, and I never picked it up again.) On Mon, Apr 13, 2009 at 1:20 PM, Stuart McGraw wrote: > 1 to the number of sentences

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Stuart McGraw
Scott Marlowe wrote: 2009/4/7 Stuart McGraw : Hello all, I have a table with a primary key column that contains sequential numbers. Sometimes I need to shift them all up or down by a fixed amount. For example, if I have four rows with primary keys, 2, 3, 4, 5, I might want to shift them down

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Richard Broersma
On Fri, Apr 10, 2009 at 11:20 AM, Scott Marlowe wrote: > Generally speaking, when you need to do this more than once or twice > in the lifetime of your data, there's something wrong with your data > model. True, but there are a few non-traditional data models that would benefit from this feature

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Stuart McGraw
Jasen Betts wrote: On 2009-04-08, Stuart McGraw wrote: Hello all, I have a table with a primary key column that contains sequential numbers. Sometimes I need to shift them all up or down by a fixed amount. For example, if I have four rows with primary keys, 2, 3, 4, 5, I might want to shif