Hi Oleg

I will have to disagree again - please read the page that you link to below carefully: "REPLACE works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted."

INSERT supports *exactly* the same 3 syntax options that REPLACE does, while UPDATE only overlaps the one syntax option, and not even fully (i.e. REPLACE does not accept a WHERE or LIMIT):

UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
    SET col_name1=expr1 [, col_name2=expr2 ...]
    [WHERE where_condition]
    [ORDER BY ...]
    [LIMIT row_count]


- Frank


Oleg Broytmann wrote:
On Fri, Nov 30, 2007 at 08:44:18PM -0800, Frank Conradie wrote:
  
In sqlbuilder the "Replace" expression currently inherits from "Update", 
but in MySQL, according to their official docs, "REPLACE works exactly 
like INSERT", i.e. "REPLACE INTO ...". Thus it looks like it should 
rather inherit from "Insert" (just replacing the "INSERT" with "REPLACE").
    

   The syntax is (http://dev.mysql.com/doc/refman/4.1/en/replace.html):

REPLACE [LOW_PRIORITY | DELAYED]
     [INTO] tbl_name
     SET col_name={expr | DEFAULT}, ...

   That is, it's much more UPDATE (because of SET) than INSERT (that uses
a list of names and a list of values, not name/value pairs).

PS. Forgive me for not answering so long.

Oleg.