Re: MERGE vs REPLACE

Поиск
Список
Период
Сортировка
От Petr Jelinek
Тема Re: MERGE vs REPLACE
Дата
Msg-id 4377BF0F.4090201@seznam.cz
обсуждение исходный текст
Ответ на Re: MERGE vs REPLACE  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: MERGE vs REPLACE  (Martijn van Oosterhout <kleptog@svana.org>)
Re: MERGE vs REPLACE  (Jochem van Dieten <jochemd@gmail.com>)
Список pgsql-hackers
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)


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Kevin Brown
Дата:
Сообщение: Re: SIGSEGV taken on 8.1 during dump/reload
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: MERGE vs REPLACE