git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3842892)
Treat a zero-D array as empty in int_enum(), per Andrew@supernews.
2005年4月23日 17:55:50 +0000 (17:55 +0000)
2005年4月23日 17:55:50 +0000 (17:55 +0000)

diff --git a/contrib/intagg/int_aggregate.c b/contrib/intagg/int_aggregate.c
index 292855018acc1d0a828960387d3fdaef0769d945..df2bd1e0336872f0d63a5ab436308f2b39087acf 100644 (file)
--- 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)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /