I have a function that has a very useful name: has_useful_state(param)
.
I have a second function that will be returning a SETOF RECORD
s of these results:
CREATE OR REPLACE FUNCTION set_of_useful_things(param TEXT, OUT has_useful_state) RETURNS SETOF RECORD AS $_$
BEGIN
SELECT some_key, COUNT(has_useful_state(some_key)) FROM ....
At any rate, here's where it goes off the rails. The function, where has_useful_state
is by far the best name for both the return column name and for the function that provides it, fails to compile with an error like this:
SELECT some_key, COUNT( $1 (some_key)) FROM ....
Obviously the function name is being treated as an alias... so how can I avoid this and still keep my useful function and column names?