]> granicus.if.org Git - postgresql/commitdiff
int_aggregate's int_enum() doesn't work correctly with arrays that
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 23 Apr 2005 05:39:19 +0000 (05:39 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 23 Apr 2005 05:39:19 +0000 (05:39 +0000)
aren't 1-D, so give an error message instead of failing.  Per report
from Ron Mayer.

contrib/intagg/int_aggregate.c

index b964bf8862c3efc2258cf4a6921cda6ddfc4199b..afe55df881b07553d00eeb982dd652c0676bfbd8 100644 (file)
@@ -220,6 +220,9 @@ int_enum(PG_FUNCTION_ARGS)
                        pc->p = p;
                        pc->flags = 0;
                }
+               /* Now that we have a detoasted array, verify dimensions */
+               if (pc->p->a.ndim != 1)
+                       elog(ERROR, "int_enum only accepts 1-D arrays");
                pc->num = 0;
                fcinfo->context = (Node *) pc;
                MemoryContextSwitchTo(oldcontext);