postgres=#
postgres=# create table logtable(t varchar(10), value varchar(50));
CREATE TABLE
postgres=#
postgres=#
postgres=# CREATE FUNCTION logfunc2(logtxt text) RETURNS timestamp AS $$
postgres$# DECLARE
postgres$# curtime timestamp;
postgres$# BEGIN
postgres$# curtime := 'now';
postgres$# INSERT INTO logtable VALUES (logtxt, curtime);
postgres$# RETURN curtime;
postgres$# END;
postgres$# $$ LANGUAGE plpgsql;
CREATE FUNCTION
postgres=#
postgres=# select logfunc2('123');
REATE
logfunc2
------------------------
2006-10-21 19:09:25.14
(1 row)
postgres=#
postgres=# select * from logtable;
REATE
t | value
-----+------------------------
123 | 2006-10-21 19:09:25.14
(1 row)
postgres=#
postgres=#
postgres=# drop function logfunc2(logtxt text);
DROP FUNCTION
postgres=# drop table logtable;