aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeAgg.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-09-28 20:00:19 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-09-28 20:00:19 +0000
commit6d0d15c451739396851d3f93f81c63a47535bf1e (patch)
tree79370fcc4630f1857bede315eb4d9beae6d7f90b /src/backend/executor/nodeAgg.c
parent23616b47d54d0a0d39a626485299403264f7d8e1 (diff)
downloadpostgresql-6d0d15c451739396851d3f93f81c63a47535bf1e.tar.gz
postgresql-6d0d15c451739396851d3f93f81c63a47535bf1e.zip
Make the world at least somewhat safe for zero-column tables, and
remove the special case in ALTER DROP COLUMN to prohibit dropping a table's last column.
Diffstat (limited to 'src/backend/executor/nodeAgg.c')
-rw-r--r--src/backend/executor/nodeAgg.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 898ca62a600..0ebf2f7151e 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -46,7 +46,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.87 2002/09/18 21:35:20 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.88 2002/09/28 20:00:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -658,20 +658,20 @@ ExecAgg(Agg *node)
if (inputTuple == NULL)
{
TupleDesc tupType;
- Datum *tupValue;
- char *null_array;
- AttrNumber attnum;
+ Datum *dvalues;
+ char *dnulls;
tupType = aggstate->csstate.css_ScanTupleSlot->ttc_tupleDescriptor;
- tupValue = projInfo->pi_tupValue;
/* watch out for null input tuples, though... */
- if (tupType && tupValue)
+ if (tupType && tupType->natts > 0)
{
- null_array = (char *) palloc(sizeof(char) * tupType->natts);
- for (attnum = 0; attnum < tupType->natts; attnum++)
- null_array[attnum] = 'n';
- inputTuple = heap_formtuple(tupType, tupValue, null_array);
- pfree(null_array);
+ dvalues = (Datum *) palloc(sizeof(Datum) * tupType->natts);
+ dnulls = (char *) palloc(sizeof(char) * tupType->natts);
+ MemSet(dvalues, 0, sizeof(Datum) * tupType->natts);
+ MemSet(dnulls, 'n', sizeof(char) * tupType->natts);
+ inputTuple = heap_formtuple(tupType, dvalues, dnulls);
+ pfree(dvalues);
+ pfree(dnulls);
}
}
}