Re: MySql 'REPLACE'
От | Vivek Khera |
---|---|
Тема | Re: MySql 'REPLACE' |
Дата | |
Msg-id | x7hezbpt7v.fsf@onceler.kciLink.com обсуждение исходный текст |
Ответ на | RE: MySql 'REPLACE' ("Diehl, Jeffrey" <jdiehl@sandia.gov>) |
Список | pgsql-sql |
>>>>> "JD" == Jeffrey Diehl <jdiehl@sandia.gov> writes: JD> Replace into does an insert by default. If however, there is JD> already a record which would cause a unique index collision, then JD> mysql does an update on that record. I want to prevent my JD> application from having to do all of that bookkeeping. No, MySQL does not do an update in that case. It deletes the existing row, then does the insert. This really screws you over when you have auto incrementing (sequence) columns, and screws you when you are not specifying every field in the row (those columns take their defaults, not the original values of the old row). It is really a useless function, as far as I can tell. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
В списке pgsql-sql по дате отправления: