diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 791f336..f9b8d0e 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1680,6 +1680,7 @@ ExecBuildSlotValueDescription(TupleTableSlot *slot, int maxfieldlen) StringInfoData buf; TupleDesc tupdesc = slot->tts_tupleDescriptor; int i; + bool write_comma = false; /* Make sure the tuple is fully deconstructed */ slot_getallattrs(slot); @@ -1693,6 +1694,10 @@ ExecBuildSlotValueDescription(TupleTableSlot *slot, int maxfieldlen) char *val; int vallen; + /* Ignore dropped column */ + if (tupdesc->attrs[i]->attisdropped) + continue; + if (slot->tts_isnull[i]) val = "null"; else @@ -1705,7 +1710,10 @@ ExecBuildSlotValueDescription(TupleTableSlot *slot, int maxfieldlen) val = OidOutputFunctionCall(foutoid, slot->tts_values[i]); } - if (i > 0) + /* Do not write a comma for first visible column of tuple string */ + if (!write_comma) + write_comma = true; + else appendStringInfoString(&buf, ", "); /* truncate if needed */