Chapman Flack <jcflack@acm.org> writes:
> Therefore:
> 5. You can create a transform for an array type, but can never refer to it
> in TRANSFORM FOR TYPE (you end up referring to the element type).
> 6. You can refer to a domain in TRANSFORM FOR TYPE, but that transform
> can never be created.
> These don't seem to be what the rules ought to be, but I don't have
> a strong intuition for what the rules ought to be instead.
Yeah, I noticed that inconsistency too, but hadn't gotten around to
researching what the spec says about it. I don't especially like it
because it puts the onus on PL implementations to dig for the
appropriate transform to apply to an argument or result, and I don't
think they're likely to do that consistently. It looks to me like
plperl and plpython are already inconsistent: plpython seems to be
digging down into arrays and domains, but plperl does not AFAICS.
So what are the odds that outside PLs do it correctly (for whatever
you think "correctly" is)? It doesn't help any that we document
none of this.
If I had my druthers I would flush every one of these special rules,
and just say that an argument/result gets transformed if there's a
transform matching its declared type, full stop. You want to
transform arrays or domains, you make a transform to match.
This would be a lot simpler to understand and potentially more
flexible. But I don't know if it falls foul of the wording of
the spec, and I concede that in some cases it'd require users
to do more work creating those additional transforms.
regards, tom lane