Re: MySql 'REPLACE' - Mailing list pgsql-sql

From Vivek Khera
Subject Re: MySql 'REPLACE'
Date
Msg-id x7hezbpt7v.fsf@onceler.kciLink.com
Whole thread Raw
In response to RE: MySql 'REPLACE'  ("Diehl, Jeffrey" <jdiehl@sandia.gov>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: No JOINs in UPDATE ... FROM?
Next
From: "Peter J. Schoenster"
Date:
Subject: Re: must I create the function check_primary_key ?