Re: Using row_to_json with %ROWTYPE ?

Поиск
Список
Период
Сортировка
От Tim Smith
Тема Re: Using row_to_json with %ROWTYPE ?
Дата
Msg-id CA+HuS5FXHBGnsFVvUhqiKZvX_xugH-j9ETyVWXoUMHOUabMAew@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Using row_to_json with %ROWTYPE ?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Using row_to_json with %ROWTYPE ?  (David Johnston <david.g.johnston@gmail.com>)
Re: Using row_to_json with %ROWTYPE ?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
>Unfortunately the function definition is not given and that is where you are seeing the error.
> To figure this out we will need to see the function.

Geez, there's just no satisfying some people !  ;-)

I did actually show you my function in an earlier mail .... but my
current bodged minimised version looks like this :


CREATE FUNCTION validateSession(session_id char(64),client_ip
inet,user_agent char(40),forcedTimeout bigint,sessionTimeout bigint)
RETURNS json AS  $$
DECLARE
v_now bigint;
v_row app_val_session_vw%ROWTYPE;
BEGIN
v_now := extract(epoch FROM now())::bigint;
select * into strict v_row from app_val_session_vw where
session_id=session_id and session_ip=client_ip;
RETURN row_to_json(v_row);
EXCEPTION
WHEN OTHERS THEN
RAISE EXCEPTION 'Failed to validate session for session % (SQLSTATE: %
 - SQLERRM: %)', session_id,SQLSTATE,SQLERRM
USING HINT = 'Database error occured (sval fail)';
 END;
$$ LANGUAGE plpgsql;


Note that I have tried a million and one different versions of the
line "RETURN row_to_json(v_row);" .... including declaring a JSON type
var and putting hte result into that before returning.  But nothing
works, it always comes back with the same session_id nonsense.


В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Cluster seems broken after pg_basebackup
Следующее
От: Guillaume Drolet
Дата:
Сообщение: Re: Cluster seems broken after pg_basebackup