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

Поиск
Список
Период
Сортировка
От Ron St-Pierre
Тема Re: most idiomatic way to "update or insert"?
Дата
Msg-id 41125669.3000402@syscor.com
обсуждение исходный текст
Ответ на Re: most idiomatic way to "update or insert"?  (Richard Huxton <dev@archonet.com>)
Ответы Re: most idiomatic way to "update or insert"?  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Richard Huxton wrote:

>
> An "update or insert" would be useful sometimes, but it's not always
> necessary. Indeed, if I find I don't know whether I'm adding or
> updating something I take a long hard look at my design - it ususally
> means I've not thought clearly about something.


> Can you give an actual example of where you need this?

How about stocks for a simple example? Let's say you have a simple table
with the stock symbol, stock exchange, high, low, open, close and
volume. Every day you update the data for each stock. But there are
always new stocks listed on an exchange, so when a new stock shows up
you have to do an insert instead of an update.

Ron



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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Sequence Question
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: trash talk