mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4d wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
@@ -80,7 +80,7 @@ struct RawStmt;
|
||||
typedef struct CachedPlanSource
|
||||
{
|
||||
int magic; /* should equal CACHEDPLANSOURCE_MAGIC */
|
||||
struct RawStmt *raw_parse_tree; /* output of raw_parser(), or NULL */
|
||||
struct RawStmt *raw_parse_tree; /* output of raw_parser(), or NULL */
|
||||
const char *query_string; /* source text of query */
|
||||
const char *commandTag; /* command tag (a constant!), or NULL */
|
||||
Oid *param_types; /* array of parameter type OIDs, or NULL */
|
||||
@@ -95,11 +95,11 @@ typedef struct CachedPlanSource
|
||||
List *query_list; /* list of Query nodes, or NIL if not valid */
|
||||
List *relationOids; /* OIDs of relations the queries depend on */
|
||||
List *invalItems; /* other dependencies, as PlanInvalItems */
|
||||
struct OverrideSearchPath *search_path; /* search_path used for
|
||||
* parsing and planning */
|
||||
struct OverrideSearchPath *search_path; /* search_path used for parsing
|
||||
* and planning */
|
||||
MemoryContext query_context; /* context holding the above, or NULL */
|
||||
Oid rewriteRoleId; /* Role ID we did rewriting for */
|
||||
bool rewriteRowSecurity; /* row_security used during rewrite */
|
||||
bool rewriteRowSecurity; /* row_security used during rewrite */
|
||||
bool dependsOnRLS; /* is rewritten query specific to the above? */
|
||||
/* If we have a generic plan, this is a reference-counted link to it: */
|
||||
struct CachedPlan *gplan; /* generic plan, or NULL if not valid */
|
||||
@@ -110,11 +110,11 @@ typedef struct CachedPlanSource
|
||||
bool is_valid; /* is the query_list currently valid? */
|
||||
int generation; /* increments each time we create a plan */
|
||||
/* If CachedPlanSource has been saved, it is a member of a global list */
|
||||
struct CachedPlanSource *next_saved; /* list link, if so */
|
||||
struct CachedPlanSource *next_saved; /* list link, if so */
|
||||
/* State kept to help decide whether to use custom or generic plans: */
|
||||
double generic_cost; /* cost of generic plan, or -1 if not known */
|
||||
double total_custom_cost; /* total cost of custom plans so far */
|
||||
int num_custom_plans; /* number of plans included in total */
|
||||
double total_custom_cost; /* total cost of custom plans so far */
|
||||
int num_custom_plans; /* number of plans included in total */
|
||||
} CachedPlanSource;
|
||||
|
||||
/*
|
||||
@@ -182,4 +182,4 @@ extern CachedPlan *GetCachedPlan(CachedPlanSource *plansource,
|
||||
QueryEnvironment *queryEnv);
|
||||
extern void ReleaseCachedPlan(CachedPlan *plan, bool useResOwner);
|
||||
|
||||
#endif /* PLANCACHE_H */
|
||||
#endif /* PLANCACHE_H */
|
||||
|
||||
Reference in New Issue
Block a user