diff --git a/src/test/subscription/t/100_bugs.pl b/src/test/subscription/t/100_bugs.pl
index cb36ca7b16..b6853e881d 100644
--- a/src/test/subscription/t/100_bugs.pl
+++ b/src/test/subscription/t/100_bugs.pl
@@ -490,4 +490,45 @@ is( $result, qq(2|f
 $node_publisher->stop('fast');
 $node_subscriber->stop('fast');
 
+# https://www.postgresql.org/message-id/flat/CAD21AoAqkNUvicgKPT_dXzNoOwpPkVTg0QPPxEcWmzT0moCJ1g%40mail.gmail.com
+# This bug happens when we rollback a subtransaction which have TOAST changes and we set
+# 'debug_logical_replication_streaming = immediate'. During reset, it frees the subtransaction entry while having
+# the TOAST changes in memory. Previously, since we zeroed the subtransaction size before freeing TOAST changes, we
+# ended up further subtracting the memory counter from zero, resulting in an assertion failure.
+$node_publisher->rotate_logfile();
+$node_publisher->append_conf('postgresql.conf', 'logical_decoding_work_mem = 64kB');
+$node_publisher->append_conf('postgresql.conf', 'debug_logical_replication_streaming = immediate');
+$node_publisher->start();
+
+$node_subscriber->rotate_logfile();
+$node_subscriber->start();
+
+$node_publisher->safe_psql(
+	'postgres', qq(
+	CREATE TABLE test_tab (a text);
+	CREATE PUBLICATION pub_test_tab FOR TABLE test_tab;
+));
+
+$node_subscriber->safe_psql(
+	'postgres', qq(
+	CREATE TABLE test_tab (a text, b int);
+	CREATE SUBSCRIPTION sub_test_tab CONNECTION '$publisher_connstr' PUBLICATION pub_test_tab WITH (streaming = on);
+));
+
+$node_publisher->safe_psql(
+	'postgres', qq(
+	BEGIN;
+	INSERT INTO test_tab (a) SELECT repeat(string_agg(to_char(g.i, 'FM0000'), ''), 50) FROM generate_series(1, 500) g(i);
+	ALTER TABLE test_tab ADD COLUMN b INT;
+	SAVEPOINT s1;
+	INSERT INTO test_tab (b, a) SELECT 1, repeat(string_agg(to_char(g.i, 'FM0000'), ''), 50) FROM generate_series(1, 500) g(i);
+	ROLLBACK TO s1;
+	COMMIT;
+));
+
+$node_publisher->wait_for_catchup('sub_test_tab');
+
+$node_publisher->stop('fast');
+$node_subscriber->stop('fast');
+
 done_testing();
