Re: remove unnecessary include in src/backend/commands/policy.c
От | Shinya Kato |
---|---|
Тема | Re: remove unnecessary include in src/backend/commands/policy.c |
Дата | |
Msg-id | CAOzEurQ9kYGd50j4O2RVT2FrLhESDCz8f+P+0y3eS1uYCJmSSg@mail.gmail.com обсуждение исходный текст |
Ответ на | remove unnecessary include in src/backend/commands/policy.c (jian he <jian.universality@gmail.com>) |
Список | pgsql-hackers |
Hi, On Sun, Sep 14, 2025 at 3:38 PM jian he <jian.universality@gmail.com> wrote: > > hi. > > in src/backend/commands/policy.c, i found that > #include "access/htup.h" > #include "access/htup_details.h" > #include "catalog/catalog.h" > #include "nodes/pg_list.h" > #include "parser/parse_node.h" > #include "utils/array.h" > > is not necessary "include", so I removed it. > > we can also remove > #include "access/relation.h" > replace relation_open to table_open, since we already did relkind check in > RangeVarCallbackForPolicy. Thanks for the patch! I can confirm that it builds successfully and passes the regression tests. However, the changes make policy.c rely on transitive includes. For example, policy.c uses GETSTRUCT(), which is defined in access/htup_details.h. Instead of being included directly, that header is currently pulled in via a fairly long chain: catalog/indexing.h -> nodes/execnodes.h -> access/tupconvert.h -> executor/tuptable.h -> access/htup_details.h While this works for now, the dependency is fragile and could break if header files are rearranged in the future. I'm not sure this is a good practice, and although I couldn't find a specific rule against it in PostgreSQL's coding conventions, it seems risky. -- Best regards, Shinya Kato NTT OSS Center
В списке pgsql-hackers по дате отправления: