On 02/06/2015 05:33 AM, Tim Smith wrote:
Nice work-around Marc. Thank you !
Nice that it works, but in the end it proves that the issue is not with
row_to_json and a row type, but with how %ROW_TYPE is being used in a
specific function. To prove it, using your earlier function modified for
your latest test case:
CREATE OR REPLACE FUNCTION public.dostuff()
RETURNS json
LANGUAGE plpgsql
AS $function$
DECLARE
v_row app_val_session_vw %ROWTYPE;
j_return json;
BEGIN
select * into strict v_row from app_val_session_vw where user_id=1;
select into j_return row_to_json(v_row);
RETURN j_return;
END;
$function$
test=# select dostuff();
dostuff
-----------------------------------------------------------------------------------
{"session_id":441122,"session_ip":"10.11.12.13","user_name":"Foobar","user_id":1}
(1 row)
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general