Re: MySql 'REPLACE'

From: Vivek Khera <khera(at)kcilink(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: MySql 'REPLACE'
Date: 2001-04-26 15:37:56
Message-ID: x7hezbpt7v.fsf@onceler.kciLink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>>>>> "JD" == Jeffrey Diehl <jdiehl(at)sandia(dot)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(at)kciLink(dot)com Rockville, MD +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2001-04-26 15:44:47 Re: simulate union in subselect
Previous Message Josh Berkus 2001-04-26 15:17:57 Re: problem with pl/pgsql