diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index ff51660..0bec854 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -1285,6 +1285,16 @@ SELECT make_array2(1, 2.5) AS numericarray;
  {1,2.5}
 (1 row)
 </screen>
+     Because the rules for common type resolution default to choosing
+     type <type>text</type> when all inputs are of unknown types, this
+     also works:
+<screen>
+SELECT make_array2('a', 'b') AS textarray;
+ textarray 
+-----------
+ {a,b}
+(1 row)
+</screen>
     </para>
 
     <para>
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 1e53f7c..645e4aa 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -2251,14 +2251,17 @@ enforce_generic_type_consistency(const Oid *actual_arg_types,
 			{
 				/*
 				 * Only way to get here is if all the ANYCOMPATIBLE args have
-				 * UNKNOWN inputs
-				 *
-				 * XXX shouldn't we use TEXT?  But not TEXTRANGE.
+				 * UNKNOWN inputs.  Resolve to TEXT as select_common_type()
+				 * would do.  That doesn't license us to use TEXTRANGE,
+				 * though.
 				 */
-				ereport(ERROR,
-						(errcode(ERRCODE_DATATYPE_MISMATCH),
-						 errmsg("could not determine polymorphic type because input has type %s",
-								"unknown")));
+				anycompatible_typeid = TEXTOID;
+				anycompatible_array_typeid = TEXTARRAYOID;
+				if (have_anycompatible_range)
+					ereport(ERROR,
+							(errcode(ERRCODE_DATATYPE_MISMATCH),
+							 errmsg("could not determine polymorphic type %s because input has type %s",
+									"anycompatiblerange", "unknown")));
 			}
 		}
 
diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out
index bd854e3..fd4ff91 100644
--- a/src/test/regress/expected/polymorphism.out
+++ b/src/test/regress/expected/polymorphism.out
@@ -1686,9 +1686,7 @@ ERROR:  function anyctest(integer, point) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11, point(1,2)) x;
                                     ^
 HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
-select x, pg_typeof(x) from anyctest('11', '12.3') x;  -- fail, should it work?
-ERROR:  could not determine polymorphic type because input has type unknown
-select x, pg_typeof(x) from anyctest('11', '12.3'::text) x;
+select x, pg_typeof(x) from anyctest('11', '12.3') x;  -- defaults to text
   x   | pg_typeof 
 ------+-----------
  12.3 | text
diff --git a/src/test/regress/sql/polymorphism.sql b/src/test/regress/sql/polymorphism.sql
index ba698b8..ec89f3c 100644
--- a/src/test/regress/sql/polymorphism.sql
+++ b/src/test/regress/sql/polymorphism.sql
@@ -912,8 +912,7 @@ $$ language sql;
 select x, pg_typeof(x) from anyctest(11, 12) x;
 select x, pg_typeof(x) from anyctest(11, 12.3) x;
 select x, pg_typeof(x) from anyctest(11, point(1,2)) x;  -- fail
-select x, pg_typeof(x) from anyctest('11', '12.3') x;  -- fail, should it work?
-select x, pg_typeof(x) from anyctest('11', '12.3'::text) x;
+select x, pg_typeof(x) from anyctest('11', '12.3') x;  -- defaults to text
 
 drop function anyctest(anycompatible, anycompatible);
 
