diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml index 4f1bc6130aa..04540ee3ccc 100644 --- a/doc/src/sgml/extend.sgml +++ b/doc/src/sgml/extend.sgml @@ -256,9 +256,11 @@ 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. + 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. @@ -289,6 +291,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