Re: MERGE Specification

Поиск
Список
Период
Сортировка
От Boxuan Zhai
Тема Re: MERGE Specification
Дата
Msg-id AANLkTinSoR4R199Vep2KJJomTiKmJiv2_8wfccF5KMmz@mail.gmail.com
обсуждение исходный текст
Ответ на Re: MERGE Specification  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: MERGE Specification  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Re: MERGE Specification  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-hackers
Dear All,
 
I have seen a lively discussion about the DO NOTING action in MERGE command. And, I think most people want it. So it will be added to my next patch.
 
Before the implementation, I still have some questions to confirm:
 
1. If we have a DO NOTHING action specified, it should be the last WHEN clause. It must be of the NOT MATCHED cases, and it CANNOT have any additional action qualifications. Am I correct?
 
2. If no DO NOTHING specified, we will imply a INSERT DEFAULT VALUES action as the end of MERGE.
My question is, is this action taken only for the NOT MATCHED tuples?  If this is the case, then what about the MATCHED tuples that match not previous actions? Ignore them?
That means we are in fact going to add two implicit WHEN clause:
               a) WHEN NOT MATCHED INSERT default values;
               b) WHEN MATCHED THEN DO NOTHING.
OR, is the INSERT DEFAULT VALUES applied to ALL tuples not matter they are MATCHED or not?
 
 
Besides, (I mean no offense, but) can this method really avoid losing row?
 
So far as I know, the DEFAULT values for table attributes are defined when the table is created and no variables are allowed in the default value expressions. That means, they are usually constants or simple serial numbers.  
 
Image that we have a MERGE command that has thousands of NOT MATCHED tuples going to the implicit action. Then, the target table will inserted with thousands of rows with DEAULT VALUES. These row will have similar (if not exactly the same) simple content, which contains NO information from the source table of MERGE. Is this really what we want? If it is not, then what is the use of the INSERT DEFAULT VALUES action?
 
Regards 

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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Concurrent MERGE
Следующее
От: Robert Haas
Дата:
Сообщение: LockDatabaseObject vs. LockSharedObject