Re: Using row_to_json with %ROWTYPE ?
От | Adrian Klaver |
---|---|
Тема | Re: Using row_to_json with %ROWTYPE ? |
Дата | |
Msg-id | 54D4E7CA.9080407@aklaver.com обсуждение исходный текст |
Ответ на | Re: Using row_to_json with %ROWTYPE ? (Tim Smith <randomdev4+postgres@gmail.com>) |
Список | pgsql-general |
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@aklaver.com
В списке pgsql-general по дате отправления: