Re: I often have to do "update if exist, else insert", is my database design wrong?

Поиск
Список
Период
Сортировка
От Francisco Reyes
Тема Re: I often have to do "update if exist, else insert", is my database design wrong?
Дата
Msg-id 28514f62d3c684f482b5c68b73cc1094@stringsutils.com
обсуждение исходный текст
Ответ на I often have to do "update if exist, else insert", is my database design wrong?  ("A B" <gentosaker@gmail.com>)
Ответы Re: I often have to do "update if exist, else insert", is my database design wrong?  (Steve Atkins <steve@blighty.com>)
Список pgsql-general
> Is this normal or are there something else I could do so I don't have
> to check if it exists?

I would say that it is normal.


> For the developers: a combined  insert/update command would be nice
> :-)

Mysql has such a beast along a some other non SQL compliant extensions.

One possible approach to what you are trying to do would be:
update existing table with new values
delete from new table all records that already exist
insert remaining new records

Which can be done all in pure sql. No need to write a program.


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

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: php + postgresql
Следующее
От: Steve Atkins
Дата:
Сообщение: Re: I often have to do "update if exist, else insert", is my database design wrong?