MERGE command for inheritance

Поиск
Список
Период
Сортировка
От Boxuan Zhai
Тема MERGE command for inheritance
Дата
Msg-id AANLkTik34fNx6QSbQP+SB8BTjiCDygsBqSMQqpUHJDFW@mail.gmail.com
обсуждение исходный текст
Ответы Re: MERGE command for inheritance  (Peter Eisentraut <peter_e@gmx.net>)
Re: MERGE command for inheritance  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Re: MERGE command for inheritance  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-hackers
Hi,
 
These days I am considering what else can be done for MERGE, And, I find inheritance tables in postgres is not supported by our MERGE command yet.

Currently, MERGE command is only able to handle the target table itself, and its children tables are not involved in the process.

I am not sure if inheritance of MERGE is needed by postgres. If we need, I may propose two methods for implementing it.
 
An easy way to do it is use a rule-like strategy. We can generate new MERGE query statements with the children table as their target tables. Then the new
query statement will be planned and executed in the normal way. This process can be put in the rewriter, before the queries are planned.
This method is quite easy but seems not follow the tradition of inheritance in Postgres.
 
 
The difficult way is to generate the plans for children table in planner, as the other commands like UPDATE and DELETE. However, because the structure of
MERGE plan is much more complex than the ordinary ModifyTable plans, this job may not as simple as we expected. We need to adjust both the main plan and the
merge actions to fit the children tables, which is not straight forward.
 
I would like to know your opinions on this problem.
 
PS: for my investigation on the inheritance actions, I find that although the children tables are modified by the UPDATE or DELETE commands on their ancestor tables, the rules defined on them are not activated during the query. Is this the case (I hope I am not asking a stupid question)? And, if so, I may ask why we want it to act like this.
 
Boxuan

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

Предыдущее
От: Boxuan Zhai
Дата:
Сообщение: Re: MERGE Specification
Следующее
От: David Fetter
Дата:
Сообщение: Re: pg_restore should accept multiple -t switches?