How can I do an UPDATE OR CREATE ?

Поиск
Список
Период
Сортировка
От Guy Fraser
Тема How can I do an UPDATE OR CREATE ?
Дата
Msg-id 3795F9E8.86D3AA03@incentre.net
обсуждение исходный текст
Список pgsql-general
Hi

I am trying to figure out how I can create an entry if one does not
exist when attempting an update.

This kind of what I want to do :

if (select "User-Name","Realm" from details;) {
    update details set "Time-Used" = old."Time-Used" + new."Time-Used";
} else {
    insert into details "User-Name","Realm","Time-Used";
}

I have not seen any documentation specifying what pragmatic operators
are available if any.

Thank You In Advance

Guy Fraser
mailto:guy@incentre.net

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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: [HACKERS] inheritance
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] bad select performance fixed by forbidding hash joins