mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Run pgindent on 9.2 source tree in preparation for first 9.3
commit-fest.
This commit is contained in:
@@ -113,7 +113,7 @@ static Expr *simplify_function(Oid funcid,
|
||||
bool process_args, bool allow_non_const,
|
||||
eval_const_expressions_context *context);
|
||||
static List *expand_function_arguments(List *args, Oid result_type,
|
||||
HeapTuple func_tuple);
|
||||
HeapTuple func_tuple);
|
||||
static List *reorder_function_arguments(List *args, HeapTuple func_tuple);
|
||||
static List *add_function_defaults(List *args, HeapTuple func_tuple);
|
||||
static List *fetch_function_defaults(HeapTuple func_tuple);
|
||||
@@ -181,7 +181,7 @@ make_opclause(Oid opno, Oid opresulttype, bool opretset,
|
||||
Node *
|
||||
get_leftop(const Expr *clause)
|
||||
{
|
||||
const OpExpr *expr = (const OpExpr *) clause;
|
||||
const OpExpr *expr = (const OpExpr *) clause;
|
||||
|
||||
if (expr->args != NIL)
|
||||
return linitial(expr->args);
|
||||
@@ -198,7 +198,7 @@ get_leftop(const Expr *clause)
|
||||
Node *
|
||||
get_rightop(const Expr *clause)
|
||||
{
|
||||
const OpExpr *expr = (const OpExpr *) clause;
|
||||
const OpExpr *expr = (const OpExpr *) clause;
|
||||
|
||||
if (list_length(expr->args) >= 2)
|
||||
return lsecond(expr->args);
|
||||
@@ -1128,15 +1128,15 @@ contain_nonstrict_functions_walker(Node *node, void *context)
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Check clauses for non-leakproof functions
|
||||
* Check clauses for non-leakproof functions
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* contain_leaky_functions
|
||||
* Recursively search for leaky functions within a clause.
|
||||
* Recursively search for leaky functions within a clause.
|
||||
*
|
||||
* Returns true if any function call with side-effect may be present in the
|
||||
* clause. Qualifiers from outside the a security_barrier view should not
|
||||
* clause. Qualifiers from outside the a security_barrier view should not
|
||||
* be pushed down into the view, lest the contents of tuples intended to be
|
||||
* filtered out be revealed via side effects.
|
||||
*/
|
||||
@@ -1155,8 +1155,8 @@ contain_leaky_functions_walker(Node *node, void *context)
|
||||
switch (nodeTag(node))
|
||||
{
|
||||
case T_Var:
|
||||
case T_Const:
|
||||
case T_Param:
|
||||
case T_Const:
|
||||
case T_Param:
|
||||
case T_ArrayExpr:
|
||||
case T_NamedArgExpr:
|
||||
case T_BoolExpr:
|
||||
@@ -1168,6 +1168,7 @@ contain_leaky_functions_walker(Node *node, void *context)
|
||||
case T_NullTest:
|
||||
case T_BooleanTest:
|
||||
case T_List:
|
||||
|
||||
/*
|
||||
* We know these node types don't contain function calls; but
|
||||
* something further down in the node tree might.
|
||||
@@ -1176,7 +1177,7 @@ contain_leaky_functions_walker(Node *node, void *context)
|
||||
|
||||
case T_FuncExpr:
|
||||
{
|
||||
FuncExpr *expr = (FuncExpr *) node;
|
||||
FuncExpr *expr = (FuncExpr *) node;
|
||||
|
||||
if (!get_func_leakproof(expr->funcid))
|
||||
return true;
|
||||
@@ -1187,7 +1188,7 @@ contain_leaky_functions_walker(Node *node, void *context)
|
||||
case T_DistinctExpr: /* struct-equivalent to OpExpr */
|
||||
case T_NullIfExpr: /* struct-equivalent to OpExpr */
|
||||
{
|
||||
OpExpr *expr = (OpExpr *) node;
|
||||
OpExpr *expr = (OpExpr *) node;
|
||||
|
||||
set_opfuncid(expr);
|
||||
if (!get_func_leakproof(expr->opfuncid))
|
||||
@@ -1208,11 +1209,11 @@ contain_leaky_functions_walker(Node *node, void *context)
|
||||
case T_CoerceViaIO:
|
||||
{
|
||||
CoerceViaIO *expr = (CoerceViaIO *) node;
|
||||
Oid funcid;
|
||||
Oid ioparam;
|
||||
bool varlena;
|
||||
Oid funcid;
|
||||
Oid ioparam;
|
||||
bool varlena;
|
||||
|
||||
getTypeInputInfo(exprType((Node *)expr->arg),
|
||||
getTypeInputInfo(exprType((Node *) expr->arg),
|
||||
&funcid, &ioparam);
|
||||
if (!get_func_leakproof(funcid))
|
||||
return true;
|
||||
@@ -1226,11 +1227,11 @@ contain_leaky_functions_walker(Node *node, void *context)
|
||||
case T_ArrayCoerceExpr:
|
||||
{
|
||||
ArrayCoerceExpr *expr = (ArrayCoerceExpr *) node;
|
||||
Oid funcid;
|
||||
Oid ioparam;
|
||||
bool varlena;
|
||||
Oid funcid;
|
||||
Oid ioparam;
|
||||
bool varlena;
|
||||
|
||||
getTypeInputInfo(exprType((Node *)expr->arg),
|
||||
getTypeInputInfo(exprType((Node *) expr->arg),
|
||||
&funcid, &ioparam);
|
||||
if (!get_func_leakproof(funcid))
|
||||
return true;
|
||||
@@ -1247,7 +1248,7 @@ contain_leaky_functions_walker(Node *node, void *context)
|
||||
|
||||
foreach(opid, rcexpr->opnos)
|
||||
{
|
||||
Oid funcid = get_opcode(lfirst_oid(opid));
|
||||
Oid funcid = get_opcode(lfirst_oid(opid));
|
||||
|
||||
if (!get_func_leakproof(funcid))
|
||||
return true;
|
||||
@@ -1256,6 +1257,7 @@ contain_leaky_functions_walker(Node *node, void *context)
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/*
|
||||
* If we don't recognize the node tag, assume it might be leaky.
|
||||
* This prevents an unexpected security hole if someone adds a new
|
||||
@@ -2683,7 +2685,7 @@ eval_const_expressions_mutator(Node *node,
|
||||
-1,
|
||||
InvalidOid,
|
||||
sizeof(Oid),
|
||||
ObjectIdGetDatum(intypioparam),
|
||||
ObjectIdGetDatum(intypioparam),
|
||||
false,
|
||||
true),
|
||||
makeConst(INT4OID,
|
||||
@@ -2812,13 +2814,13 @@ eval_const_expressions_mutator(Node *node,
|
||||
* TRUE: drop all remaining alternatives
|
||||
* If the first non-FALSE alternative is a constant TRUE,
|
||||
* we can simplify the entire CASE to that alternative's
|
||||
* expression. If there are no non-FALSE alternatives,
|
||||
* expression. If there are no non-FALSE alternatives,
|
||||
* we simplify the entire CASE to the default result (ELSE).
|
||||
*
|
||||
* If we have a simple-form CASE with constant test
|
||||
* expression, we substitute the constant value for contained
|
||||
* CaseTestExpr placeholder nodes, so that we have the
|
||||
* opportunity to reduce constant test conditions. For
|
||||
* opportunity to reduce constant test conditions. For
|
||||
* example this allows
|
||||
* CASE 0 WHEN 0 THEN 1 ELSE 1/0 END
|
||||
* to reduce to 1 rather than drawing a divide-by-0 error.
|
||||
@@ -3581,12 +3583,12 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
|
||||
* deliver a constant result, use a transform function to generate a
|
||||
* substitute node tree, or expand in-line the body of the function
|
||||
* definition (which only works for simple SQL-language functions, but
|
||||
* that is a common case). Each case needs access to the function's
|
||||
* that is a common case). Each case needs access to the function's
|
||||
* pg_proc tuple, so fetch it just once.
|
||||
*
|
||||
* Note: the allow_non_const flag suppresses both the second and third
|
||||
* strategies; so if !allow_non_const, simplify_function can only return
|
||||
* a Const or NULL. Argument-list rewriting happens anyway, though.
|
||||
* strategies; so if !allow_non_const, simplify_function can only return a
|
||||
* Const or NULL. Argument-list rewriting happens anyway, though.
|
||||
*/
|
||||
func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
|
||||
if (!HeapTupleIsValid(func_tuple))
|
||||
@@ -3603,7 +3605,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
|
||||
{
|
||||
args = expand_function_arguments(args, result_type, func_tuple);
|
||||
args = (List *) expression_tree_mutator((Node *) args,
|
||||
eval_const_expressions_mutator,
|
||||
eval_const_expressions_mutator,
|
||||
(void *) context);
|
||||
/* Argument processing done, give it back to the caller */
|
||||
*args_p = args;
|
||||
@@ -3618,7 +3620,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
|
||||
if (!newexpr && allow_non_const && OidIsValid(func_form->protransform))
|
||||
{
|
||||
/*
|
||||
* Build a dummy FuncExpr node containing the simplified arg list. We
|
||||
* Build a dummy FuncExpr node containing the simplified arg list. We
|
||||
* use this approach to present a uniform interface to the transform
|
||||
* function regardless of how the function is actually being invoked.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user