diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-23 17:55:50 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-23 17:55:50 +0000 |
commit | d79eeef38b075025c68ddf7debba4224b6aeabc8 (patch) | |
tree | d883b33196e5746dcb31a3f4d1f48101dc9114e9 /contrib/intagg/int_aggregate.c | |
parent | 3842892492622a56577dea07be758cffa4501afa (diff) | |
download | postgresql-d79eeef38b075025c68ddf7debba4224b6aeabc8.tar.gz postgresql-d79eeef38b075025c68ddf7debba4224b6aeabc8.zip |
Treat a zero-D array as empty in int_enum(), per Andrew@supernews.
Diffstat (limited to 'contrib/intagg/int_aggregate.c')
-rw-r--r-- | contrib/intagg/int_aggregate.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/intagg/int_aggregate.c b/contrib/intagg/int_aggregate.c index 292855018ac..df2bd1e0336 100644 --- a/contrib/intagg/int_aggregate.c +++ b/contrib/intagg/int_aggregate.c @@ -243,7 +243,8 @@ int_enum(PG_FUNCTION_ARGS) pc->flags = 0; } /* Now that we have a detoasted array, verify dimensions */ - if (pc->p->a.ndim != 1) + /* We'll treat a zero-D array as empty, below */ + if (pc->p->a.ndim > 1) elog(ERROR, "int_enum only accepts 1-D arrays"); pc->num = 0; fcinfo->context = (Node *) pc; @@ -252,7 +253,7 @@ int_enum(PG_FUNCTION_ARGS) else /* use an existing one */ pc = (CTX *) fcinfo->context; /* Are we done yet? */ - if (pc->num >= pc->p->items) + if (pc->p->a.ndim < 1 || pc->num >= pc->p->items) { /* We are done */ if (pc->flags & TOASTED) |