Doc: clarify behavior of "anyrange" pseudo-type.
authorTom Lane
Tue, 17 Mar 2020 19:05:17 +0000 (15:05 -0400)
committerTom Lane
Tue, 17 Mar 2020 19:05:17 +0000 (15:05 -0400)
I noticed that we completely failed to document the restriction
that an "anyrange" result type has to be inferred from an "anyrange"
input.  The docs also were less clear than they could be about the
relationship between "anyrange" and "anyarray".

It's been like this all along, so back-patch.

doc/src/sgml/extend.sgml

index 2e3b5f678e754edb2d7674fccf447050062f0e8d..8c68d595e52f20f351976ed757f3ad56c4b5949a 100644 (file)
      anyarray positions must be an array whose elements are
      the same type appearing in the anyelement positions.
      Similarly, if there are positions declared anyrange
-     and others declared anyelement, the actual range type in
-     the anyrange positions must be a range whose subtype is
-     the same type appearing in the anyelement positions.
-     anynonarray is treated exactly the same as anyelement,
+     and others declared anyelement or anyarray,
+     the actual range type in the anyrange positions must be a
+     range whose subtype is the same type appearing in
+     the anyelement positions and the same as the element type
+     of the anyarray positions.
+     anynonarray is treated exactly the same as anyelement,
      but adds the additional constraint that the actual type must not be
      an array type.
      anyenum is treated exactly the same as anyelement,
      will only accept arrays of enum types.
     
 
+    
+     In most cases, the parser can infer the actual data type for a
+     polymorphic result type from arguments that are of a different
+     polymorphic type; for example anyarray can be deduced
+     from anyelement or vice versa.  The exception is that a
+     polymorphic result of type anyrange requires an argument
+     of type anyrange; it cannot be deduced
+     from anyarray or anyelement arguments.  This
+     is because there could be multiple range types with the same subtype.
+    
+
     
      Note that anynonarray and anyenum do not represent
      separate type variables; they are the same type as