Peter Eisentraut wrote:
>
> In that regard, MERGE is quite flexible, but MERGE doesn't address the
> point of REPLACE, because MERGE requires *two* tables as input, whereas
> REPLACE only takes *one*. Unless someone can show that you can trick
> MERGE into doing the REPLACE job anyway, we're not discussing the same
> thing.
>
I am really not db expert and I don't have copy of sql standard but you
don't need to use 2 tables I think - USING part can also be subquery
(some SELECT) and if I am right then you could simulate what REPLACE
does because in PostgreSQL you are not forced to specify FROM clause in
SELECT. So you could in theory do
MERGE INTO tablename USING (SELECT 1 AS myid) ON (tablename.id = myid) ...
But I am not sure if this is what you want.
--
Regards
Petr Jelinek (PJMODOS)