Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 31d846e

Browse files
committed
Doc: clarify behavior of "anyrange" pseudo-type.
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.
1 parent 9d9784c commit 31d846e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

doc/src/sgml/extend.sgml

+16-3
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,11 @@
256256
<type>anyarray</type> positions must be an array whose elements are
257257
the same type appearing in the <type>anyelement</type> positions.
258258
Similarly, if there are positions declared <type>anyrange</type>
259-
and others declared <type>anyelement</type>, the actual range type in
260-
the <type>anyrange</type> positions must be a range whose subtype is
261-
the same type appearing in the <type>anyelement</type> positions.
259+
and others declared <type>anyelement</type> or <type>anyarray</type>,
260+
the actual range type in the <type>anyrange</type> positions must be a
261+
range whose subtype is the same type appearing in
262+
the <type>anyelement</type> positions and the same as the element type
263+
of the <type>anyarray</type> positions.
262264
<type>anynonarray</type> is treated exactly the same as <type>anyelement</type>,
263265
but adds the additional constraint that the actual type must not be
264266
an array type.
@@ -289,6 +291,17 @@
289291
will only accept arrays of enum types.
290292
</para>
291293

294+
<para>
295+
In most cases, the parser can infer the actual data type for a
296+
polymorphic result type from arguments that are of a different
297+
polymorphic type; for example <type>anyarray</type> can be deduced
298+
from <type>anyelement</type> or vice versa. The exception is that a
299+
polymorphic result of type <type>anyrange</type> requires an argument
300+
of type <type>anyrange</type>; it cannot be deduced
301+
from <type>anyarray</type> or <type>anyelement</type> arguments. This
302+
is because there could be multiple range types with the same subtype.
303+
</para>
304+
292305
<para>
293306
Note that <type>anynonarray</type> and <type>anyenum</type> do not represent
294307
separate type variables; they are the same type as

0 commit comments

Comments
 (0)