|
6 | 6 | * Copyright (c) 2003-2009, PostgreSQL Global Development Group
|
7 | 7 | *
|
8 | 8 | * IDENTIFICATION
|
9 |
| - * $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.28 2009/01/01 17:23:48 momjian Exp $ |
| 9 | + * $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.29 2009/06/09 18:15:04 tgl Exp $ |
10 | 10 | *
|
11 | 11 | *-------------------------------------------------------------------------
|
12 | 12 | */
|
@@ -520,14 +520,19 @@ array_agg_finalfn(PG_FUNCTION_ARGS)
|
520 | 520 | intdims[1];
|
521 | 521 | intlbs[1];
|
522 | 522 |
|
| 523 | +/* |
| 524 | + * Test for null before Asserting we are in right context. This is |
| 525 | + * to avoid possible Assert failure in 8.4beta installations, where |
| 526 | + * it is possible for users to create NULL constants of type internal. |
| 527 | + */ |
| 528 | +if (PG_ARGISNULL(0)) |
| 529 | +PG_RETURN_NULL();/* returns null iff no input values */ |
| 530 | + |
523 | 531 | /* cannot be called directly because of internal-type argument */
|
524 | 532 | Assert(fcinfo->context&&
|
525 | 533 | (IsA(fcinfo->context,AggState)||
|
526 | 534 | IsA(fcinfo->context,WindowAggState)));
|
527 | 535 |
|
528 |
| -if (PG_ARGISNULL(0)) |
529 |
| -PG_RETURN_NULL();/* returns null iff no input values */ |
530 |
| - |
531 | 536 | state= (ArrayBuildState*)PG_GETARG_POINTER(0);
|
532 | 537 |
|
533 | 538 | dims[0]=state->nelems;
|
|