FWIW the reason I read through this patch is that I wondered if there
was anything in common with this other patch
https://commitfest.postgresql.org/8/459/ -- and the answer seems to be
"no". What that patch does is add a new construct TYPE(1+1)
which in this case returns "int4"; I guess if we wanted to augment that
functionality to cover Pavel's use case we would additionally need ELEMENTTYPE(somearray)
and ARRAYTYPE(some-non-array)
in the core grammar ... sounds like a hard sell.
BTW are we all agreed that enabling foo%ARRAYTYPE
and foo%ELEMENTYPE
in plpgsql's DECLARE section is what we want for this?
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services