Re: MERGE vs REPLACE

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: josh(at)agliodbs(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org, Simon Riggs <simon(at)2ndquadrant(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Petr Jelinek <pjmodos(at)seznam(dot)cz>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, jd(at)commandprompt(dot)com
Subject: Re: MERGE vs REPLACE
Date: 2005-11-15 19:24:01
Message-ID: c2d9e70e0511151124o31d86e21n7d60c46dea2a1ce6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/15/05, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> Simon,
>
> > The UPSERT concept is also supported by Teradata, who simply append an
> > ELSE INSERT clause onto the standard UPDATE syntax. MySQL REPLACE seems
> > to me to be a fairly small subset of MERGE functionality and we ought to
> > be able to offer that functionality as a side branch of the main work.
>
> Yes, I guess my hesitation on the full-table-lock strategy is that it
> doesn't really fulfill the mandate for why people want REPLACE-like
> statements ... to give them an INSERT-or-UPDATE with *higher* efficiency
> and concurrency than doing two statements. That being said, I've
> personally designed more than a dozen web applications and have not yet
> been faced with a single circumstance of not knowing whether I wanted to
> INSERT or UPDATE. I've even ported MySQL apps and found it easy to
> re-code them to do "if $id = 0, then insert ..." without even needing to
> use a pl/pgsql hack.
>

Actually REPLACE is not INSERT or UPDATE...
REPLACE means INSERT if already exists DELETE then INSERT

can be used as an UPDATE if you use the SET clause but, it is optional

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2005-11-15 19:43:06 Re: R?f. : RE: Running PostGre on DVD
Previous Message mark 2005-11-15 18:46:48 Re: MERGE vs REPLACE