Skip to content

Commit f4e27a0

Browse files
author
Nikita Glukhov
committed
Fix whitespace
1 parent 06ea3e2 commit f4e27a0

File tree

3 files changed

+35
-47
lines changed

3 files changed

+35
-47
lines changed

src/backend/executor/execQual.c

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -264,16 +264,18 @@ static Datum ExecEvalGroupingFuncExpr(GroupingFuncExprState *gstate,
264264

265265
static Datum
266266
ExecEvalSubscriptionRef(SubscriptionRefExprState *sbstate,
267-
ExprContext *econtext,
268-
bool *isNull,
269-
ExprDoneCond *isDone)
267+
ExprContext *econtext,
268+
bool *isNull,
269+
ExprDoneCond *isDone)
270270
{
271-
SubscriptionRef *sbsRef = (SubscriptionRef *) sbstate->xprstate.expr;
272-
Oid containerType, typsubscription;
271+
SubscriptionRef *sbsRef = (SubscriptionRef *) sbstate->xprstate.expr;
272+
Oid containerType,
273+
typsubscription;
273274
bool isAssignment = (sbsRef->refassgnexpr != NULL);
274275
bool eisnull;
275-
Datum *upper, *lower;
276-
ListCell *l;
276+
Datum *upper,
277+
*lower;
278+
ListCell *l;
277279
int i = 0,
278280
j = 0;
279281
SubscriptionExecData sbsdata;
@@ -288,10 +290,8 @@ ExecEvalSubscriptionRef(SubscriptionRefExprState *sbstate,
288290

289291
sbsdata.xprcontext = econtext;
290292
sbsdata.isNull = isNull;
291-
sbsdata.containerSource = ExecEvalExpr(sbstate->refexpr,
292-
econtext,
293-
isNull,
294-
isDone);
293+
sbsdata.containerSource = ExecEvalExpr(sbstate->refexpr, econtext,
294+
isNull, isDone);
295295

296296
/*
297297
* If refexpr yields NULL, and it's a fetch, then result is NULL. In the
@@ -322,12 +322,10 @@ ExecEvalSubscriptionRef(SubscriptionRefExprState *sbstate,
322322
upperProvided[i++] = false;
323323
continue;
324324
}
325+
325326
upperProvided[i] = true;
327+
upper[i++] = ExecEvalExpr(eltstate, econtext, &eisnull, NULL);
326328

327-
upper[i++] = ExecEvalExpr(eltstate,
328-
econtext,
329-
&eisnull,
330-
NULL);
331329
/* If any index expr yields NULL, result is NULL or error */
332330
if (eisnull)
333331
{
@@ -358,12 +356,10 @@ ExecEvalSubscriptionRef(SubscriptionRefExprState *sbstate,
358356
lowerProvided[j++] = false;
359357
continue;
360358
}
359+
361360
lowerProvided[j] = true;
361+
lower[j++] = ExecEvalExpr(eltstate, econtext, &eisnull, NULL);
362362

363-
lower[j++] = ExecEvalExpr(eltstate,
364-
econtext,
365-
&eisnull,
366-
NULL);
367363
/* If any index expr yields NULL, result is NULL or error */
368364
if (eisnull)
369365
{
@@ -375,6 +371,7 @@ ExecEvalSubscriptionRef(SubscriptionRefExprState *sbstate,
375371
return (Datum) NULL;
376372
}
377373
}
374+
378375
/* this can't happen unless parser messed up */
379376
if (i != j)
380377
elog(ERROR, "upper and lower index lists are not same length");
@@ -389,19 +386,15 @@ ExecEvalSubscriptionRef(SubscriptionRefExprState *sbstate,
389386
containerType = getBaseTypeAndTypmod(sbsRef->refcontainertype, &sbsRef->reftypmod);
390387
typsubscription = get_subscription(containerType);
391388

392-
if(OidIsValid(typsubscription))
393-
{
394-
return OidFunctionCall3(typsubscription,
395-
Int32GetDatum(SBS_EXEC),
396-
PointerGetDatum(sbstate),
397-
PointerGetDatum(&sbsdata));
398-
}
399-
else
400-
{
389+
if (!OidIsValid(typsubscription))
401390
/* this can't happen */
402391
elog(ERROR, "can not find subscription procedure for type %s",
403392
format_type_be(containerType));
404-
}
393+
394+
return OidFunctionCall3(typsubscription,
395+
Int32GetDatum(SBS_EXEC),
396+
PointerGetDatum(sbstate),
397+
PointerGetDatum(&sbsdata));
405398
}
406399

407400
/* ----------------------------------------------------------------

src/backend/parser/parse_expr.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ transformIndirection(ParseState *pstate, Node *basenode, List *indirection)
482482
}
483483
/* process trailing subscripts, if any */
484484
if (subscripts)
485-
{
486485
result = (Node *) transformContainerSubscripts(pstate,
487486
result,
488487
exprType(result),
@@ -491,8 +490,6 @@ transformIndirection(ParseState *pstate, Node *basenode, List *indirection)
491490
subscripts,
492491
NULL);
493492

494-
}
495-
496493
return result;
497494
}
498495

src/backend/parser/parse_node.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -284,27 +284,26 @@ transformArrayType(Oid *containerType, int32 *containerTypmod)
284284

285285
SubscriptionRef *
286286
transformContainerSubscripts(ParseState *pstate,
287-
Node *containerBase,
288-
Oid containerType,
289-
Oid elementType,
290-
int32 containerTypMod,
291-
List *indirection,
292-
Node *assignFrom)
287+
Node *containerBase,
288+
Oid containerType,
289+
Oid elementType,
290+
int32 containerTypMod,
291+
List *indirection,
292+
Node *assignFrom)
293293
{
294-
bool isSlice = false;
295-
List *upperIndexpr = NIL;
296-
List *lowerIndexpr = NIL;
297-
ListCell *idx;
298-
SubscriptionRef *sbsref, *prepared_sbsref;
294+
bool isSlice = false;
295+
List *upperIndexpr = NIL;
296+
List *lowerIndexpr = NIL;
297+
ListCell *idx;
298+
SubscriptionRef *sbsref,
299+
*prepared_sbsref;
300+
Oid typsubscription = get_subscription(containerType);
299301

300-
Oid typsubscription = get_subscription(containerType);
301302
if (!OidIsValid(typsubscription))
302-
{
303303
ereport(ERROR,
304304
(errcode(ERRCODE_DATATYPE_MISMATCH),
305305
errmsg("cannot subscript type %s because it does not support subscription",
306306
format_type_be(containerType))));
307-
}
308307

309308
/*
310309
* Caller may or may not have bothered to determine elementType. Note
@@ -375,7 +374,6 @@ transformContainerSubscripts(ParseState *pstate,
375374
sbsref->refexpr = (Expr *) containerBase;
376375
sbsref->refassgnexpr = (Expr *) assignFrom;
377376

378-
379377
prepared_sbsref = (SubscriptionRef *) OidFunctionCall3(typsubscription,
380378
Int32GetDatum(SBS_VALIDATION),
381379
PointerGetDatum(sbsref),

0 commit comments

Comments
 (0)