plpgsql and escape

Поиск
Список
Период
Сортировка
От darthxiong@libero.it
Тема plpgsql and escape
Дата
Msg-id 20021021150015.65FD6475F5A@postgresql.org
обсуждение исходный текст
Ответы Re: plpgsql and escape
Список pgsql-general
hi all!
i'm trying to do this ( converting unix time to human readable time in another table )

create function align_vs() returns opaque as
'
        declare
                line_vs vs%ROWTYPE;
                itime vs.step_time%TYPE;
        begin

        itime := to_char( timestamp ''epoch'' + interval ''NEW.step_time seconds'', ''YYYY-MM-DD HH24:MI:SS'' );
        update vs set w_id = NEW.w_id, step_id = %NEW.step_id, step_time = itime where w_id = NEW.w_id;

        return null;
end;
' language plpgsql;

the double ' around NEW.step_time blocks its interpolation. which is the correct escaping sintax here?

TIA
Ivan

--
There is no such thing as a problem without a gift for you in its hands.

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

Предыдущее
От: "Jeff MacDonald"
Дата:
Сообщение: help with pgxml_xpath
Следующее
От: "Robert John Shepherd"
Дата:
Сообщение: Can't compile --with-perl