In pgAdminIII I create a function that returns multiple rows in a single column named identifier using RETURN TABLE:
CREATE OR REPLACE FUNCTION test(
IN parm1 date,
IN parm2 interval)
RETURNS TABLE(identifier INT)
AS
$BODY$
BEGIN
RETURN QUERY
SELECT 1;
END;
$BODY$
LANGUAGE plpgsql;
After the function is created, pgAdminIII shows the function as having the following definition:
CREATE OR REPLACE FUNCTION test(IN parm1 date, IN parm2 interval)
RETURNS SETOF integer AS
$BODY$
BEGIN
RETURN QUERY
SELECT 1;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
When executing the function it follows the logic of the RETURNS TABLE
. But, when editing the function it will pickup the RETURNS SETOF
. This provides different functionality than the function I specified (e.g. the name of the returned column no longer exists).
So, how can I force pgAdminIII to keep the returned column name of identifier
? I don't particularly care whether I define it as a TABLE
or SETOF
.