Re: most idiomatic way to "update or insert"?

Поиск
Список
Период
Сортировка
От Jerry Sievers
Тема Re: most idiomatic way to "update or insert"?
Дата
Msg-id m3hdrco0u3.fsf@prod01.jerrysievers.com
обсуждение исходный текст
Ответ на Re: most idiomatic way to "update or insert"?  ("Peter Darley" <pdarley@kinesis-cem.com>)
Список pgsql-general
gsstark@mit.edu (Greg Stark) writes:
> This happens most often when I have a list of items and have a UI that allows
> the user to edit the entire list and commit a whole new list in one action.
> It's much easier to simply delete the old list and insert the entire new list
> in a single query than to try to figure out which rows to delete and which to
> insert.

Right, but this is going to quit working for you as soon as foreign
key references are involved.  For that matter, other types of
dependent objects will prevent this as well.

In other words, when your relational database actually becomes
relational  :-)

I too was in the habit of the delete/insert as a lazy mans update on
simple schemad DBs.

HTH

--
-------------------------------------------------------------------------------
Jerry Sievers   305 854-3001 (home)     WWW ECommerce Consultant
                305 321-1144 (mobile    http://www.JerrySievers.com/

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

Предыдущее
От: ree
Дата:
Сообщение: How Two JOINS from one table
Следующее
От: Gaetano Mendola
Дата:
Сообщение: Re: Copy data from one table to another, where some records might