I've got a postgresql stored procedure, which is returning an integer. When I call that function, the result is returned with the function name as column name.
For example the name of the function is: "add-person". The column name, when invoking the function, is "add-person".
Is there a way to make the database return the integer with a self-choosen column name? For example "id"?
I think it is pretty easy, but I currently miss the forests for the trees..
Edit: What i'd missed to tell, is that the return value is a variable, like so:
CREATE OR REPLACE FUNCTION "scheme"."add-person"(arggivenname character varying, argfamilyname character varying) RETURNS integer AS $BODY$ DECLARE varResponse integer; BEGIN -- Operations before INSERT INTO "scheme"."table" ( given_name, family_name ) VALUES ( arggivenname, argfamilyname ) RETURNING "id" INTO varResponse; -- Operations after RETURN varResponse; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100;