Re: Replaceing records

Поиск
Список
Период
Сортировка
От Harald Fuchs
Тема Re: Replaceing records
Дата
Msg-id pu8yp4pohq.fsf@srv.protecting.net
обсуждение исходный текст
Ответ на Replaceing records  (Alex <alex@meerkatsoft.com>)
Ответы Re: Replaceing records
Список pgsql-general
In article <87ekywbqz1.fsf@stark.dyndns.tv>,
Greg Stark <gsstark@mit.edu> writes:

> Out of curiosity, what does the mysql syntax look like? How would you handle
> something where the insert and update were quite different like:

> INSERT INFO foo (pk,value,count,date_ins) values (?,?,1,now())
> OR UPDATE foo set value=?, count=count+1, date_upd=now() where pk = ?

You can't.  The only thing MySQL has to offer is

  REPLACE INTO tbl_name [(col_name,...)] VALUES (expr,...)

`REPLACE' works exactly like `INSERT', except that if an old record in
the table has the same value as a new record on a `UNIQUE' index or
`PRIMARY KEY', the old record is deleted before the new record is
inserted.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: TCL trigger doesn't work after deleting a column
Следующее
От: Josué Maldonado
Дата:
Сообщение: Re: TCL trigger doesn't work after deleting a column