Pavel Stehule <pavel.stehule@gmail.com> writes:
> I still thinking about a "median" type functions. My idea is to
> introduce a new syntax for stype definition - like
> stype = type, or
> stype = ARRAY OF type [ ORDER [ DESC | ASC ]], or
> stype = TUPLESTORE OF type, or
> stype = TUPLESORT OF type [ DESC | ASC ]
This seems like a fairly enormous amount of conceptual (and code)
infrastructure just to make it possible to build median() out of spare
parts. It's also exposing some implementation details that I'd just as
soon not expose in SQL. I'd rather just implement median as a
special-purpose aggregate.
regards, tom lane