Re: MERGE vs REPLACE

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: MERGE vs REPLACE
Дата
Msg-id 20051123090926.GA8374@svana.org
обсуждение исходный текст
Ответ на Re: MERGE vs REPLACE  (Petr Jelinek <pjmodos@seznam.cz>)
Ответы Re: MERGE vs REPLACE  (Lyubomir Petrov <lpetrov@sysmaster.com>)
Список pgsql-hackers
On Wed, Nov 23, 2005 at 12:24:24AM +0100, Petr Jelinek wrote:
> Btw about that keys, oracle gives error on many-to-one or many-to-many
> relationship between the source and target tables.

The standard has something called a "cardinality violation" if the
to-be-merged table doesn't match 1-1 with the rest of the statement. If
I had access to an Oracle I'd run two tests on MERGE:

1. Does the joining column have to have an index? For example, make a
column that's full of unique values but no unique index. According to
my reading of the the standard, this should still work (just slower).

2. Additionally, only the rows involved in the MERGE need to be
uniquely referenced, so if you add duplicate values but add a WHERE
clause to exclude those, it should also work.

My feeling is that requiring an index will limit it's usefulness as a
general tool.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Materialized views (Was Re: Improving count(*))
Следующее
От: Alvaro Herrera
Дата:
Сообщение: PL/php in pg_pltemplate