Skip site navigation (1) Skip section navigation (2)

BUG #2198: Now returns always same date and time during a session

From: "Jacques Gollion" <jgollion(at)sambatechnologies(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2198: Now returns always same date and time during a session
Date: 2006-01-23 11:40:43
Message-ID: 20060123114043.80AF6F0AC7@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2198
Logged by:          Jacques Gollion
Email address:      jgollion(at)sambatechnologies(dot)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;

Responses

pgsql-bugs by date

Next:From: Robert HostetterDate: 2006-01-23 14:56:52
Subject: BUG #2203: Group by, suggested "feature"
Previous:From: Sunil BasuDate: 2006-01-23 11:04:20
Subject: BUG #2197: PostgreSQL error- 'could not read block 0 of relation'

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group