timestamp default value - Mailing list pgsql-novice

From Ivan Horvath
Subject timestamp default value
Date
Msg-id 20020218133651.65308.qmail@web14701.mail.yahoo.com
Whole thread Raw
List 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

pgsql-novice by date:

Previous
From: Ivan Horvath
Date:
Subject: Re: problem in executing a function
Next
From: John Herreshoff
Date:
Subject: pg_dump - groups and users.