Re: Handling RestrictInfo in expression_tree_walker

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: Handling RestrictInfo in expression_tree_walker
Дата
Msg-id CA+HiwqHwqzauM_cHpvNagrk+OkzgdyPuqkPdigTDpz=XBjSfsg@mail.gmail.com
обсуждение исходный текст
Ответ на Handling RestrictInfo in expression_tree_walker  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
Ответы Re: Handling RestrictInfo in expression_tree_walker  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
Список pgsql-hackers
Hi Konstantin,

On Wed, Aug 7, 2019 at 4:24 PM Konstantin Knizhnik
<k.knizhnik@postgrespro.ru> wrote:
>
> Hi hackers,
>
> I wonder if there is some particular reason for not handling
> T_RestrictInfo node tag in expression_tree_walker?
> There are many data structure in Postgres which contains lists of
> RestrictInfo or expression with RestrictInfo as parameter (for example
> orclause in RestrictInfo).
> To handle such cases now it is needed to write code performing list
> iteration and calling expression_tree_walker for each list element and
> handling RrestrictInfo in callback function:
>
> static bool
> change_varno_walker(Node *node, ChangeVarnoContext *context)
> {
>      if (node == NULL)
>          return false;
>
>      if (IsA(node, Var) && ((Var *) node)->varno == context->oldRelid)
>      {
>          ((Var *) node)->varno = context->newRelid;
>          ((Var *) node)->varnoold = context->newRelid;
>          return false;
>      }
>      if (IsA(node, RestrictInfo))
>      {
>          change_rinfo((RestrictInfo*)node, context->oldRelid,
> context->newRelid);
>          return false;
>      }
>      return expression_tree_walker(node, change_varno_walker, context);
> }
>
> Are there any complaints against handling RestrictInfo in
> expression_tree_walker?

As I understand it, RestrictInfo is not something that appears in
query trees or plan trees, but only in the planner data structures as
means of caching some information about the clauses that they wrap.  I
see this comment describing what expression_tree_walker() is supposed
to handle:

 * The node types handled by expression_tree_walker include all those
 * normally found in target lists and qualifier clauses during the planning
 * stage.

You may also want to read this discussion:

https://www.postgresql.org/message-id/553FC9BC.5060402%402ndquadrant.com

Thanks,
Amit



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

Предыдущее
От: Kuntal Ghosh
Дата:
Сообщение: Re: POC: Cleaning up orphaned files using undo logs
Следующее
От: Konstantin Knizhnik
Дата:
Сообщение: Re: Built-in connection pooler