Try a function like this:
CREATE FUNCTION foo(...) RETURNS INT4 AS '
SELECT shoesize FROM customers ORDER BY time LIMIT 1
' LANGUAGE 'sql';
It gives an error that returning multiple values is not allowed. It
clearly does not return multiple values; it has a LIMIT 1. So I think
this is a bug. Is there any other better way to do this perhaps? Is
there a way to find a row where some field is the most in its range?
In my application I'm having to do this a lot.
The workaround that I found is to do this in plpgsql. I can do it
like this:
DECLARE result INT4;
SELECT shoesize INTO result ...
RETURN result;
END;
but I should be able to do this in sql, not plpgsql.
Thanks for any help