Re: how does one replace a row in Postgresql? (ala MySQL REPLACE)

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: how does one replace a row in Postgresql? (ala MySQL REPLACE)
Дата
Msg-id 20011212064556.A32473@wolff.to
обсуждение исходный текст
Ответ на how does one replace a row in Postgresql? (ala MySQL REPLACE)  (Terrence Brannon <metaperl@mac.com>)
Список pgsql-sql
On Tue, Dec 11, 2001 at 02:09:19PM -0800, Terrence Brannon <metaperl@mac.com> wrote:
> A common task is to check to see if a row with a certain primary 
> key exists before inserting it. If the row exists, then you 
> simply update/overwrite its contents with the new row data. 
> Otherwise you insert it.
> 
> MySQL has a REPLACE command which does this.
> 
> I didn't see one in the Postgresql manual. How do you do this in 
> Postgresql?

Another option that doesn't require testing of the response from one
sql statement before executing another is to delete rows with the
matching primary key. Then do an insert.


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

Предыдущее
От: Haller Christoph
Дата:
Сообщение: Re: Variable Length Binary String (not large)
Следующее
От: Arian Prins
Дата:
Сообщение: Re: How would i do this?