diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c
index 7a48ce624d..2c82b86dd1 100644
--- a/contrib/intarray/_int_gist.c
+++ b/contrib/intarray/_int_gist.c
@@ -181,8 +181,9 @@ g_int_compress(PG_FUNCTION_ARGS)
 		PREPAREARR(r);
 
 		if (ARRNELEMS(r) >= 2 * num_ranges)
-			elog(NOTICE, "input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
-				 2 * num_ranges - 1, ARRNELEMS(r));
+			ereport(ERROR,
+					(errmsg("input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
+							2 * num_ranges - 1, ARRNELEMS(r))));
 
 		retval = palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(r),
diff --git a/contrib/intarray/expected/_int.out b/contrib/intarray/expected/_int.out
index 6abb17e2e5..cad37f1a24 100644
--- a/contrib/intarray/expected/_int.out
+++ b/contrib/intarray/expected/_int.out
@@ -566,6 +566,8 @@ SELECT count(*) from test__int WHERE a @@ '!20 & !21';
   6343
 (1 row)
 
+INSERT INTO test__int SELECT array(SELECT x FROM generate_series(1, 1001) x); -- should fail
+ERROR:  input array is too big (199 maximum allowed, 1001 current), use gist__intbig_ops opclass instead
 DROP INDEX text_idx;
 CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 0));
 ERROR:  value 0 out of bounds for option "numranges"
diff --git a/contrib/intarray/sql/_int.sql b/contrib/intarray/sql/_int.sql
index d9d987bdb1..a947c4f8fd 100644
--- a/contrib/intarray/sql/_int.sql
+++ b/contrib/intarray/sql/_int.sql
@@ -125,6 +125,8 @@ SELECT count(*) from test__int WHERE a @@ '(20&23)|(50&68)';
 SELECT count(*) from test__int WHERE a @@ '20 | !21';
 SELECT count(*) from test__int WHERE a @@ '!20 & !21';
 
+INSERT INTO test__int SELECT array(SELECT x FROM generate_series(1, 1001) x); -- should fail
+
 DROP INDEX text_idx;
 CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 0));
 CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 253));
