mirror of
https://github.com/postgres/postgres.git
synced 2025-12-22 17:42:17 +03:00
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
89 lines
3.0 KiB
C
89 lines
3.0 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* clauses.h
|
|
* prototypes for clauses.c.
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/optimizer/clauses.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef CLAUSES_H
|
|
#define CLAUSES_H
|
|
|
|
#include "nodes/relation.h"
|
|
|
|
|
|
#define is_opclause(clause) ((clause) != NULL && IsA(clause, OpExpr))
|
|
#define is_funcclause(clause) ((clause) != NULL && IsA(clause, FuncExpr))
|
|
|
|
typedef struct
|
|
{
|
|
int numWindowFuncs; /* total number of WindowFuncs found */
|
|
Index maxWinRef; /* windowFuncs[] is indexed 0 .. maxWinRef */
|
|
List **windowFuncs; /* lists of WindowFuncs for each winref */
|
|
} WindowFuncLists;
|
|
|
|
extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
|
|
Expr *leftop, Expr *rightop,
|
|
Oid opcollid, Oid inputcollid);
|
|
extern Node *get_leftop(const Expr *clause);
|
|
extern Node *get_rightop(const Expr *clause);
|
|
|
|
extern bool not_clause(Node *clause);
|
|
extern Expr *make_notclause(Expr *notclause);
|
|
extern Expr *get_notclausearg(Expr *notclause);
|
|
|
|
extern bool or_clause(Node *clause);
|
|
extern Expr *make_orclause(List *orclauses);
|
|
|
|
extern bool and_clause(Node *clause);
|
|
extern Expr *make_andclause(List *andclauses);
|
|
extern Node *make_and_qual(Node *qual1, Node *qual2);
|
|
extern Expr *make_ands_explicit(List *andclauses);
|
|
extern List *make_ands_implicit(Expr *clause);
|
|
|
|
extern bool contain_agg_clause(Node *clause);
|
|
extern void get_agg_clause_costs(PlannerInfo *root, Node *clause,
|
|
AggSplit aggsplit, AggClauseCosts *costs);
|
|
|
|
extern bool contain_window_function(Node *clause);
|
|
extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef);
|
|
|
|
extern double expression_returns_set_rows(Node *clause);
|
|
|
|
extern bool contain_subplans(Node *clause);
|
|
|
|
extern bool contain_mutable_functions(Node *clause);
|
|
extern bool contain_volatile_functions(Node *clause);
|
|
extern bool contain_volatile_functions_not_nextval(Node *clause);
|
|
extern char max_parallel_hazard(Query *parse);
|
|
extern bool is_parallel_safe(PlannerInfo *root, Node *node);
|
|
extern bool contain_nonstrict_functions(Node *clause);
|
|
extern bool contain_leaked_vars(Node *clause);
|
|
|
|
extern Relids find_nonnullable_rels(Node *clause);
|
|
extern List *find_nonnullable_vars(Node *clause);
|
|
extern List *find_forced_null_vars(Node *clause);
|
|
extern Var *find_forced_null_var(Node *clause);
|
|
|
|
extern bool is_pseudo_constant_clause(Node *clause);
|
|
extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids);
|
|
|
|
extern int NumRelids(Node *clause);
|
|
|
|
extern void CommuteOpExpr(OpExpr *clause);
|
|
extern void CommuteRowCompareExpr(RowCompareExpr *clause);
|
|
|
|
extern Node *eval_const_expressions(PlannerInfo *root, Node *node);
|
|
|
|
extern Node *estimate_expression_value(PlannerInfo *root, Node *node);
|
|
|
|
extern Query *inline_set_returning_function(PlannerInfo *root,
|
|
RangeTblEntry *rte);
|
|
|
|
#endif /* CLAUSES_H */
|