diff --git a/src/include/executor/execScan.h b/src/include/executor/execScan.h index 2003cbc7ed5..818809f2819 100644 --- a/src/include/executor/execScan.h +++ b/src/include/executor/execScan.h @@ -222,6 +222,49 @@ ExecScanExtended(ScanState *node, */ if (qual == NULL || ExecQual(qual, econtext)) { + StringInfoData t; + StringInfoData bin; + StringInfoData attname; + + initStringInfo(&t); + initStringInfo(&bin); + initStringInfo(&attname); + + for (int i = 0; i < slot->tts_nvalid; i++) + { + FormData_pg_attribute *a = TupleDescAttr(slot->tts_tupleDescriptor, i); + + if (i > 0) + { + appendStringInfoChar(&t, ','); + appendStringInfoChar(&bin, ','); + appendStringInfoChar(&attname, ','); + } + + appendStringInfoString(&attname, NameStr(a->attname)); + + if (!slot->tts_isnull[i]) + { + Oid outfunc; + bool varlena; + + getTypeOutputInfo(a->atttypid, &outfunc, &varlena); + appendStringInfoString(&t, OidOutputFunctionCall(outfunc, slot->tts_values[i])); + appendStringInfo(&bin, UINT64_FORMAT, slot->tts_values[i]); + } + else + { + appendStringInfoString(&t, "NULL"); + appendStringInfoString(&bin, "NULL"); + } + } + elog(NOTICE, "scan tuple = (%s) (%s) (%s)", attname.data, t.data, bin.data); + pfree(t.data); + pfree(bin.data); + pfree(attname.data); + + /* leaking output func string */ + /* * Found a satisfactory scan tuple. */