Paul A Jungwirth <pj@illuminatedcomputing.com> writes:
> I was looking at resolve_generic_type to add anymultirange support,
> and the range logic doesn't seem correct to me.
Hmmm...
> resolve_generic_type(ANYARRAYOID, x, ANYRANGEOID) - this will return
> an array of the *range type*, but that contracts the normal
> relationship between anyelement and anyrange. It should return an
> array of the range's element type.
I seem to recall that we discussed this exact point during development
of the range feature, and concluded that this was the behavior we
wanted, ie, treat anyrange like a scalar for this purpose. Otherwise
there isn't any way to use a polymorphic function to build an array
of ranges, and that seemed more useful than being able to build
an array of the range elements. Jeff might remember more here.
> resolve_generic_type(ANYRANGEOID, x, ANYRANGEOID) - this will return
> the known range's *element* type, but it should return the known
> range.
Yeah, that seems like a flat-out bug.
> Fortunately we never call the function in either of those ways.
Wouldn't it depend on the signature+result type of the user-defined
function we're dealing with? (That is, calls with constant argument
types are probably not the interesting ones.)
regards, tom lane