> It works correctly if you rename the column name to anything other than _a :
>
> CREATE OR REPLACE FUNCTION test_internal(_a text)
> RETURNS TABLE(a text) -- <- different than _a
> LANGUAGE sql
> It also works if you rename the parameter (_a) here with something else.
Ah, of course! Sorry for the confusion.. The return column shadows the parameter in the outer function...
Thanks for the explanation! No bug, just accidentally naming the returned column wrong.
-Floris