
#if 0
	if (modified_attrs_valid)
	{
		bool		id_key = false;
		bool		hdci_id_key_req;
		Bitmapset  *hdci_attrs = HeapDetermineColumnsInfo(relation, hot_attrs, id_attrs,
														  &oldtup, newtup, &id_key);

/* 		hdci_id_key_req = bms_overlap(modified_attrs, hdci_attrs) || id_key; */
/*  		Assert(bms_equal(modified_attrs, hdci_attrs)); */
/* 		Assert(rep_id_key_required == hdci_id_key_req); */
		Assert(id_key == id_has_external);
	}
#endif

#if 0
	if (modified_attrs_valid)
	{
		bool		id_key = false;
		bool		hdci_id_key_req;
		Bitmapset  *hdci_attrs = HeapDetermineColumnsInfo(relation, hot_attrs, id_attrs,
														  &oldtup, newtup, &id_key);

		hdci_id_key_req = bms_overlap(modified_attrs, hdci_attrs) || id_key;

		/* Compare bitmapsets and log differences */
		if (!bms_equal(modified_attrs, hdci_attrs))
		{
			Bitmapset  *only_in_modified = bms_difference(modified_attrs, hdci_attrs);
			Bitmapset  *only_in_hdci = bms_difference(hdci_attrs, modified_attrs);
			int			attidx = -1;
			TupleDesc	tupdesc = RelationGetDescr(relation);

			elog(WARNING, "Bitmapset mismatch in HeapDetermineColumnsInfo for relation %s",
				 RelationGetRelationName(relation));
			elog(WARNING, "  ExecCheckIndexedAttrsForChanges: %s", bmsToString(modified_attrs));
			elog(WARNING, "  HeapDetermineColumnsInfo:     %s", bmsToString(hdci_attrs));

			/* Log and compare attributes only in modified_attrs */
			attidx = -1;
			if (bms_num_members(only_in_modified) > 0)
			{
				elog(WARNING, "  Attributes reported changed by ExecCheckIndexedAttrsForChanges but not HeapDetermineColumnsInfo:");

				while ((attidx = bms_next_member(only_in_modified, attidx)) >= 0)
				{
					AttrNumber	attnum = attidx + FirstLowInvalidHeapAttributeNumber;

					if (attnum > 0 && attnum <= tupdesc->natts)
					{
						Form_pg_attribute att = TupleDescAttr(tupdesc, attnum - 1);
						Datum		old_val,
									new_val;
						bool		old_isnull,
									new_isnull;

						old_val = heap_getattr(&oldtup, attnum, tupdesc, &old_isnull);
						new_val = heap_getattr(newtup, attnum, tupdesc, &new_isnull);

						if (old_isnull != new_isnull)
						{
							elog(WARNING, "    %s (attnum %d): NULL status differs (old=%s, new=%s) - CORRECT DETECTION",
								 NameStr(att->attname), attnum,
								 old_isnull ? "NULL" : "NOT NULL",
								 new_isnull ? "NULL" : "NOT NULL");
						}
						else if (!old_isnull && !new_isnull)
						{
							if (!datum_image_eq(old_val, new_val, att->attbyval, att->attlen))
							{
								elog(WARNING, "    %s (attnum %d): binary values differ - CORRECT DETECTION",
									 NameStr(att->attname), attnum);
							}
							else
							{
								elog(WARNING, "    %s (attnum %d): binary values are IDENTICAL - FALSE POSITIVE (HeapDetermineColumnsInfo is correct)",
									 NameStr(att->attname), attnum);
							}
						}
						else
						{
							elog(WARNING, "    %s (attnum %d): both NULL - FALSE POSITIVE (HeapDetermineColumnsInfo is correct)",
								 NameStr(att->attname), attnum);
						}
					}
				}
			}

			/* Log and compare attributes only in hdci_attrs */
			attidx = -1;
			if (bms_num_members(only_in_hdci) > 0)
			{
				elog(WARNING, "  Attributes reported changed by HeapDetermineColumnsInfo but not ExecCheckIndexedAttrsForChanges:");

				while ((attidx = bms_next_member(only_in_hdci, attidx)) >= 0)
				{
					AttrNumber	attnum = attidx + FirstLowInvalidHeapAttributeNumber;

					if (attnum > 0 && attnum <= tupdesc->natts)
					{
						Form_pg_attribute att = TupleDescAttr(tupdesc, attnum - 1);
						Datum		old_val,
									new_val;
						bool		old_isnull,
									new_isnull;

						old_val = heap_getattr(&oldtup, attnum, tupdesc, &old_isnull);
						new_val = heap_getattr(newtup, attnum, tupdesc, &new_isnull);

						if (old_isnull != new_isnull)
						{
							elog(WARNING, "    %s (attnum %d): NULL status differs (old=%s, new=%s) - CORRECT DETECTION",
								 NameStr(att->attname), attnum,
								 old_isnull ? "NULL" : "NOT NULL",
								 new_isnull ? "NULL" : "NOT NULL");
						}
						else if (!old_isnull && !new_isnull)
						{
							if (!datum_image_eq(old_val, new_val, att->attbyval, att->attlen))
							{
								elog(WARNING, "    %s (attnum %d): binary values differ - CORRECT DETECTION",
									 NameStr(att->attname), attnum);
							}
							else
							{
								elog(WARNING, "    %s (attnum %d): binary values are IDENTICAL - FALSE NEGATIVE (ExecCheckIndexedAttrsForChanges is correct)",
									 NameStr(att->attname), attnum);
							}
						}
						else
						{
							elog(WARNING, "    %s (attnum %d): both NULL - FALSE NEGATIVE (ExecCheckIndexedAttrsForChanges is correct)",
								 NameStr(att->attname), attnum);
						}
					}
				}
			}

			bms_free(only_in_modified);
			bms_free(only_in_hdci);
		}

		/* Compare replica identity logic */
		if (rep_id_key_required != hdci_id_key_req)
		{
			elog(WARNING, "Replica identity logic mismatch for relation %s",
				 RelationGetRelationName(relation));
			elog(WARNING, "  ExecCheckIndexedAttrsForChanges (rep_id_key_required): %s",
				 rep_id_key_required ? "TRUE" : "FALSE");
			elog(WARNING, "  HeapDetermineColumnsInfo (hdci_id_key_req):          %s",
				 hdci_id_key_req ? "TRUE" : "FALSE");
		}
	}
#endif

