mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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.
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user