How to add a column in a executor node?

Поиск
Список
Период
Сортировка
От peter.trautmeier@gmx.de
Тема How to add a column in a executor node?
Дата
Msg-id 20070824150734.216520@gmx.net
обсуждение исходный текст
Список pgsql-hackers
Hi all,

I want to add a column, i.e. an additional TargetEntry, in an executor node named Foo that is placed on top of the
usuallycreated plan. This node Foo will calculate the column which is then used to sort the relation subsequently. If
desired,the column added by Foo is finally removed by a projection node, and might thus be a junk col.
 

(Projection 
that removes bar, 
if desired)||
Sort,
sorts by bar||
Foo,
adds column bar||
Usual
Plan||
...


How do I add an additional TargetEntry in my Foo node? Unfortunately, it does not suffice to simply append the
TargetEntryafter copying the child's targetlist in make_foo(Plan *). (I tested it and seems that some client side code
complainsabout 'advertised_#cols != actual_#cols')
 

How do I compute/evaluate the column? I just see ExecProject which  evaluates the _whole_ targetlist with
ExecTargetList.But I would like to retrieve a tuple from the child node, evaluate my expression, wrap it into a
TargetEntryand append it to the tuple. Iterate.
 

Regards,
Peter


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Buildfarm failures MSVC
Следующее
От: Tom Lane
Дата:
Сообщение: Re: SQL feature requests