>>>>> "Tom" == Tom Lane <t...@sss.pgh.pa.us> writes:
Tom> Well, okay, but you've not said anything that wouldn't be Tom> handled just as well by some logic that adds a fixed Tom> integer-constant-zero flag column to the rows going into the Tom> tuplesort. Adding such a column unconditionally even for non-hypothetical functions would break the optimization for sorting a single column (which is a big deal, something like 3x speed difference, for by-value types). Adding it only for hypothetical set functions is making a distinction in how functions are executed that I don't think is warranted - imagine for example a function that calculates some measure over a frequency distribution by adding a known set of boundary values to the sort; this would not be a hypothetical set function in terms of argument processing, but it would still benefit from the extra sort column. I did not want to unnecessarily restrict such possibilities. >> It would still be overloaded in some sense because a non-hypothetical >> ordered set function could still take an arbitrary number of args >> (using variadic "any") - there aren't any provided, but there's no >> good reason to disallow user-defined functions doing that - so you'd >> still need a special value like -1 for aggordnargs to handle that. Tom> Sure. But a -1 to indicate "not applicable" doesn't seem like it's Tom> too much of a stretch. It's the -2 business that's bothering me. Tom> Again, that seems unnecessarily non-orthogonal --- who's to say which Tom> functions would want to constrain the number of direct arguments and Tom> which wouldn't? (I wonder whether having this info in the catalogs Tom> isn't the wrong thing anyhow, as opposed to expecting the functions Tom> themselves to check the argument count at runtime.) Not checking the number of arguments to a function until runtime seems a bit on the perverse side. Having a fixed number of direct args is the "normal" case (as seen from the fact that all the non-hypothetical ordered set functions in the spec and in our patch have fixed argument counts). -- Andrew (irc:RhodiumToad) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers