Re: Adding CORRESPONDING to Set Operations

Поиск
Список
Период
Сортировка
От Kerem Kat
Тема Re: Adding CORRESPONDING to Set Operations
Дата
Msg-id CAJZSWkVGTLr8ScxJbCLCc_NALN9qZn469u4_v6JNyz2G7ohCWA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Adding CORRESPONDING to Set Operations  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Adding CORRESPONDING to Set Operations
Список pgsql-hackers
CORRESPONDING clause take 2

After realizing that modifying prepunion.c to include a custom subquery
is not easy(incomprehensible to me) as it sounds and turning into a
hassle after making several uninformed changes, I decided to go with
modifying analyze.c.

The incomprehensible part is constructing a custom subquery as a
SubqueryScan.

Anyway I managed to implement the clause as a Subquery in analyze.c.

In the method transformSetOperationTree, if the node is a setoperation and
contains a corresponding clause, i.e. CORRESPONDING, or CORRESPONDING
BY(columns...),
we determine the common column names. Column ordering in select statements
are not important to the CORRESPONDING. With the common column names
in hand, we create a RangeSubselect node accordingly and replace the original
statement op->larg with the new RangeSubselect. RangeSubselect in turn has the
original op->larg as a from clause. We do the same to op->rarg too.

There were no changes done in prepunion.c

There are documentation changes and one regression test in the patch.


Best Regards,

Kerem KAT

Вложения

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

Предыдущее
От: Hitoshi Harada
Дата:
Сообщение: Re: Underspecified window queries in regression tests
Следующее
От: Hitoshi Harada
Дата:
Сообщение: Re: Underspecified window queries in regression tests