diff --git a/src/test/modules/test_custom_types/test_custom_types--1.0.sql b/src/test/modules/test_custom_types/test_custom_types--1.0.sql
index ce0e905d636..132bbbafb7d 100644
--- a/src/test/modules/test_custom_types/test_custom_types--1.0.sql
+++ b/src/test/modules/test_custom_types/test_custom_types--1.0.sql
@@ -32,6 +32,11 @@ RETURNS boolean
 AS 'MODULE_PATHNAME'
 LANGUAGE C STRICT;
 
+CREATE FUNCTION int_custom_typanalyze_stattarget_sensitive(internal)
+RETURNS boolean
+AS 'MODULE_PATHNAME'
+LANGUAGE C STRICT;
+
 --
 -- The int_custom type definition
 --
diff --git a/src/test/modules/test_custom_types/test_custom_types.c b/src/test/modules/test_custom_types/test_custom_types.c
index 41262044b47..d0b16677179 100644
--- a/src/test/modules/test_custom_types/test_custom_types.c
+++ b/src/test/modules/test_custom_types/test_custom_types.c
@@ -28,6 +28,7 @@ PG_FUNCTION_INFO_V1(int_custom_in);
 PG_FUNCTION_INFO_V1(int_custom_out);
 PG_FUNCTION_INFO_V1(int_custom_typanalyze_false);
 PG_FUNCTION_INFO_V1(int_custom_typanalyze_invalid);
+PG_FUNCTION_INFO_V1(int_custom_typanalyze_stattarget_sensitive);
 PG_FUNCTION_INFO_V1(int_custom_eq);
 PG_FUNCTION_INFO_V1(int_custom_ne);
 PG_FUNCTION_INFO_V1(int_custom_lt);
@@ -75,6 +76,17 @@ int_custom_typanalyze_false(PG_FUNCTION_ARGS)
 	PG_RETURN_BOOL(false);
 }
 
+Datum
+int_custom_typanalyze_stattarget_sensitive(PG_FUNCTION_ARGS)
+{
+	VacAttrStats *stats = (VacAttrStats *) PG_GETARG_POINTER(0);
+
+	if (stats->attstattarget < 0)
+		PG_RETURN_BOOL(true);
+	else
+		PG_RETURN_BOOL(false);
+}
+
 /*
  * Callback used to compute invalid statistics.
  */
