The following bug has been logged online:
Bug reference: 2198
Logged by: Jacques Gollion
Email address: jgollion@sambatechnologies.com
PostgreSQL version: 8.1.2
Operating system: Windows 2000
Description: Now returns always same date and time during a session
Details:
The following functions returns the first time the right date and time but
when called at several date and time returns the date that was returned at
the first call. To get again the right date, it is necessary do disconnect
and reconnect.
===================================================
CREATE OR REPLACE FUNCTION getserverdate(szdatetime_p "varchar")
RETURNS "varchar" AS
$BODY$
DECLARE tNow_l timestamp ;
DECLARE szdatetime_l VARCHAR(128);
begin
szdatetime_l := '-1';
tNow_l := Now();
RAISE LOG ' tNow_l = %', tNow_l;
szdatetime_l := TO_CHAR(tNow_l,'YYYYMMDDHH24MISS');
RAISE LOG ' szdatetime_l = %', szdatetime_l;
return szdatetime_l;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION getserverdate(szdatetime_p "varchar") OWNER TO postgres;
GRANT EXECUTE ON FUNCTION getserverdate(szdatetime_p "varchar") TO public;
GRANT EXECUTE ON FUNCTION getserverdate(szdatetime_p "varchar") TO
postgres;
GRANT EXECUTE ON FUNCTION getserverdate(szdatetime_p "varchar") TO client;
GRANT EXECUTE ON FUNCTION getserverdate(szdatetime_p "varchar") TO batch;