*   ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.76 2003/08/08 21:42:59 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.77 2003/09/04 15:10:10 tgl Exp $
  *
  **********************************************************************/
 
    pfree(stroid);
 
    /* A list of attribute names for argument TG_relatts */
+   /* note: we deliberately include dropped atts here */
    Tcl_DStringAppendElement(&tcl_trigtup, "");
    for (i = 0; i < tupdesc->natts; i++)
        Tcl_DStringAppendElement(&tcl_trigtup,
        modvalues[i] = (Datum) NULL;
    }
 
-   modnulls = palloc(tupdesc->natts + 1);
+   modnulls = palloc(tupdesc->natts);
    memset(modnulls, 'n', tupdesc->natts);
-   modnulls[tupdesc->natts] = '\0';
 
    /************************************************************
     * Care for possible elog(ERROR)'s below
 
    for (i = 0; i < tupdesc->natts; i++)
    {
+       /* ignore dropped attributes */
+       if (tupdesc->attrs[i]->attisdropped)
+           continue;
+
        /************************************************************
         * Get the attribute name
         ************************************************************/
 
    for (i = 0; i < tupdesc->natts; i++)
    {
+       /* ignore dropped attributes */
+       if (tupdesc->attrs[i]->attisdropped)
+           continue;
+
        /************************************************************
         * Get the attribute name
         ************************************************************/