Repair incorrect dumping of user-defined aggregate with null initcond.
authorTom Lane <[email protected]>
Tue, 28 May 2002 15:40:36 +0000 (15:40 +0000)
committerTom Lane <[email protected]>
Tue, 28 May 2002 15:40:36 +0000 (15:40 +0000)
(Already fixed in current, but need a patch for 7.2.2.)

src/bin/pg_dump/pg_dump.c

index f6e67719f08525f85bf2be78d2c039262061cb6c..1d20a3deceaa3724d0a4b601cfe8641ea7e7bd2d 100644 (file)
@@ -22,7 +22,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.241.2.1 2002/05/14 02:08:22 ishii Exp $
+ *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.241.2.2 2002/05/28 15:40:36 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1910,7 +1910,10 @@ getAggregates(int *numAggs)
                agginfo[i].aggfinalfn = strdup(PQgetvalue(res, i, i_aggfinalfn));
                agginfo[i].aggtranstype = strdup(PQgetvalue(res, i, i_aggtranstype));
                agginfo[i].aggbasetype = strdup(PQgetvalue(res, i, i_aggbasetype));
-               agginfo[i].agginitval = strdup(PQgetvalue(res, i, i_agginitval));
+               if (PQgetisnull(res, i, i_agginitval))
+                       agginfo[i].agginitval = NULL;
+               else
+                       agginfo[i].agginitval = strdup(PQgetvalue(res, i, i_agginitval));
                agginfo[i].usename = strdup(PQgetvalue(res, i, i_usename));
                if (strlen(agginfo[i].usename) == 0)
                        write_msg(NULL, "WARNING: owner of aggregate function \"%s\" appears to be invalid\n",