Re: Proposed refactoring of planner header files
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2019-01-28T21:35:49Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes: > On 2019-01-28 15:50:22 -0500, Tom Lane wrote: >> Andres Freund <andres@anarazel.de> writes: >>> Ugh, isn't it nicer to just use the underlying struct type instead of >>> that? >> No, because that'd mean that anyplace relying on optimizer.h would also >> have to write "struct PlannerInfo" rather than "PlannerInfo"; the >> effects wouldn't be limited to the header itself. > Why? It can be called with the typedef'd version, or not. Because I don't want users of the header to have to declare, say, local variables as "struct PlannerInfo *root" instead of "PlannerInfo *root". The former is not project style and I will not accept forcing that in order to save a couple of #ifdefs in headers. I don't actually understand what you find so ugly about it. One idea that would save a lot of random "struct foo" hacks in headers is to allow nodes.h to include "typedef struct MyNode MyNode" for any recognized node type. We could either do that just for nodes we've found it useful for, or pre-emptively for the whole list. regards, tom lane
Commits
-
Refactor index cost estimation functions in view of IndexClause changes.
- e89f14e2bb9f 12.0 landed
-
Simplify the planner's new representation of indexable clauses a little.
- 8fd3fdd85a3e 12.0 landed
-
Move pattern selectivity code from selfuncs.c to like_support.c.
- 49fa99e54ec0 12.0 landed
-
Refactor planner's header files.
- f09346a9c621 12.0 landed
-
Make some small planner API cleanups.
- a1b8c41e990e 12.0 landed