Thread: PL/Ruby timestamp problem

PL/Ruby timestamp problem

From
Anton Nikiforov
Date:
Dear All!
I have the following problem programming PL/Ruby trigger function
The function looks like:
CREATE OR REPLACE FUNCTION control.function_log() RETURNS TRIGGER
SECURITY INVOKER AS '
    data = "<LOGOPERATION>\n"
      ccurrent_time = PLruby.exec("select now()",1,"value")
        data += "\t<TIME>#{ccurrent_time}</TIME>\n"
    data += "\t<USER>\n"
..........
    PL::OK
' LANGUAGE 'plruby';

This is a strange thing but i expect to get current time but got:
<LOGOPERATION>
<TIME>Sun Jul 21 10:46:10 MSK 1974</TIME>
<USER>
..........

Is this PostgreSQL/Ruby or "device my_hands" problem? And in case the
answer is not the last from the list - could someone please help with
the solution?

--
Best regards,
Anton Nikiforov

Attachment