timestamp default value

From: Ivan Horvath <pillesoft(at)yahoo(dot)co(dot)uk>
To: pgsql-new <pgsql-novice(at)postgresql(dot)org>
Subject: timestamp default value
Date: 2002-02-18 13:36:51
Message-ID: 20020218133651.65308.qmail@web14701.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi All,

i created a small stored procedure to test how fast is
pgsql, and how the now() as timestamp function is
working.
but i recognized something strange!!!

i created a table with the following command:
CREATE TABLE "ms_hist" (
"msh_id" int4 DEFAULT nextval('seq_ms_hist'::text)
NOT NULL,
"mod_date" timestamptz DEFAULT now() NOT NULL,
CONSTRAINT "ms_hist_pk" PRIMARY KEY ("msh_id")
) WITH OIDS;
i have a sequence as well:
CREATE SEQUENCE "seq_ms_hist" INCREMENT 1 MINVALUE 1
MAXVALUE 9223372036854775807 CACHE 1;
and here is the stored procedure:
CREATE FUNCTION "test_time1"() RETURNS "opaque" AS
'DECLARE
counter int4;
BEGIN
for counter in 1..10000 loop
insert into ms_hist default values);
end loop;
END;
' LANGUAGE 'plpgsql';

so the function is executed but all the 10000 records
mod_date value is the same.
how this can be???
please help me!!

thanks
Ivan

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

Browse pgsql-novice by date

  From Date Subject
Next Message Ivan Horvath 2002-02-18 13:39:23 Re: problem in executing a function
Previous Message Allan M. Wind 2002-02-17 06:18:00 Object Relational Mapping