| От | Tom Lane |
|---|---|
| Тема | Re: Traversing targetlist to find accessed columns |
| Дата | |
| Msg-id | 2242899.1670078015@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Traversing targetlist to find accessed columns (Amin <amin.fallahi@gmail.com>) |
| Список | pgsql-hackers |
Amin <amin.fallahi@gmail.com> writes:
> Having a query, I am trying to find out all the columns that need to be
> accessed (their varattno and vartype). I have access to a targetlist
> representing a tree like this. So, I am looking for a function that
> recursively traverses the tree and gives me the VARs. So, for SELECT
> a,b,b+c from tab; I am interested in [a,b]. Is such a function currently
> implemented in postgresql? How can I use it?
pull_var_clause() might help you, or one of its siblings in
src/backend/optimizer/util/var.c, or you could use that as a
template to write your own --- it doesn't take much code if
you use expression_tree_walker to do the dirty work.
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера