int numSortCols;
/*
- * Check we're called as aggregate, and get the Agg node's
- * group-lifespan context
+ * Check we're called as aggregate (and not a window function), and
+ * get the Agg node's group-lifespan context
*/
if (AggCheckCallContext(fcinfo, &gcontext) != AGG_CONTEXT_AGGREGATE)
elog(ERROR, "ordered-set aggregate called in non-aggregate context");
if (PG_ARGISNULL(0))
osastate = ordered_set_startup(fcinfo, false);
else
- {
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
osastate = (OSAPerGroupState *) PG_GETARG_POINTER(0);
- }
/* Load the datum into the tuplesort object, but only if it's not null */
if (!PG_ARGISNULL(1))
if (PG_ARGISNULL(0))
osastate = ordered_set_startup(fcinfo, true);
else
- {
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
osastate = (OSAPerGroupState *) PG_GETARG_POINTER(0);
- }
/* Form a tuple from all the other inputs besides the transition value */
slot = osastate->qstate->tupslot;
bool isnull;
int64 rownum;
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
+ Assert(AggCheckCallContext(fcinfo, NULL) == AGG_CONTEXT_AGGREGATE);
/* Get and check the percentile argument */
if (PG_ARGISNULL(1))
double proportion;
bool isnull;
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
+ Assert(AggCheckCallContext(fcinfo, NULL) == AGG_CONTEXT_AGGREGATE);
/* Get and check the percentile argument */
if (PG_ARGISNULL(1))
bool isnull = true;
int i;
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
+ Assert(AggCheckCallContext(fcinfo, NULL) == AGG_CONTEXT_AGGREGATE);
/* If there were no regular rows, the result is NULL */
if (PG_ARGISNULL(0))
bool isnull;
int i;
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
+ Assert(AggCheckCallContext(fcinfo, NULL) == AGG_CONTEXT_AGGREGATE);
/* If there were no regular rows, the result is NULL */
if (PG_ARGISNULL(0))
FmgrInfo *equalfn;
bool shouldfree;
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
+ Assert(AggCheckCallContext(fcinfo, NULL) == AGG_CONTEXT_AGGREGATE);
/* If there were no regular rows, the result is NULL */
if (PG_ARGISNULL(0))
TupleTableSlot *slot;
int i;
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
+ Assert(AggCheckCallContext(fcinfo, NULL) == AGG_CONTEXT_AGGREGATE);
/* If there were no regular rows, the rank is always 1 */
if (PG_ARGISNULL(0))
MemoryContext tmpcontext;
int i;
- /* safety check */
- if (AggCheckCallContext(fcinfo, NULL) != AGG_CONTEXT_AGGREGATE)
- elog(ERROR, "ordered-set aggregate called in non-aggregate context");
+ Assert(AggCheckCallContext(fcinfo, NULL) == AGG_CONTEXT_AGGREGATE);
/* If there were no regular rows, the rank is always 1 */
if (PG_ARGISNULL(0))