diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml index 74130dc51d1..afd2b8f9fcc 100644 --- a/doc/src/sgml/extend.sgml +++ b/doc/src/sgml/extend.sgml @@ -225,10 +225,12 @@ 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, @@ -258,6 +260,17 @@ 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