Re: changing multiple pk's in one update

Поиск
Список
Период
Сортировка
От Glenn Maynard
Тема Re: changing multiple pk's in one update
Дата
Msg-id d18085b50904131432o1d3af00ci250d1077024648f5@mail.gmail.com
обсуждение исходный текст
Ответ на Re: changing multiple pk's in one update  (Richard Broersma <richard.broersma@gmail.com>)
Ответы Re: changing multiple pk's in one update  (Richard Broersma <richard.broersma@gmail.com>)
Список pgsql-sql
On Mon, Apr 13, 2009 at 5:18 PM, Richard Broersma
<richard.broersma@gmail.com> 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 set with ON UPDATE
> CASCADE then the shifts will be cascaded to all references
> automatically.

Right.  I'm still dusting off my SQL after a long period of corrosion.  :)

The same applies, though, if you have external references to the PK;
for example, if you have a web interface where "/sense/10/3" refers to
entry 10, sense 3.  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 careful with
locking...

--
Glenn Maynard


В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Broersma
Дата:
Сообщение: Re: changing multiple pk's in one update
Следующее
От: Richard Broersma
Дата:
Сообщение: Re: changing multiple pk's in one update