Re: timestamp value - Mailing list pgsql-novice

From Ivan Horvath
Subject Re: timestamp value
Date
Msg-id 20020304074549.55032.qmail@web14706.mail.yahoo.com
Whole thread Raw
In response to Re: timestamp value  ("Josh Berkus" <josh@agliodbs.com>)
Responses Re: timestamp value
List pgsql-novice
Thanks for answer,

here is the code of the stored procedure:

DROP FUNCTION a_function();

CREATE FUNCTION a_function () RETURNS interval AS '
DECLARE
        process_time interval;
BEGIN
        FOR i IN 1..10000 LOOP
            INSERT INTO unit (unit_name, mod_date)
VALUES (''a'', current_timestamp);
        END LOOP;

        select into process_time max(mod_date) -
min(mod_date) from unit;

        RETURN process_time;

END;'
LANGUAGE 'plpgsql';

and here is the the table structure:
 DROP SEQUENCE seq_unit;
 CREATE SEQUENCE seq_unit;

 DROP TABLE unit;
 CREATE TABLE unit (
    unit_id int4 NOT NULL default nextval('seq_unit')
CONSTRAINT unit_pk PRIMARY KEY,
    unit_name varchar(10) NOT NULL CHECK (unit_name <>
''),
    mod_user varchar(10) NOT NULL DEFAULT
current_user(),
    mod_date timestamp(0) NOT NULL
 );

thank you

Ivan

--- Josh Berkus <josh@agliodbs.com> wrote:
> Ivan,
>
> > i created a table, which has a field; type is
> > timestamp to store the record
> creation/modification
> > value.
> >
> > if i fill this table from a stored procedure the
> field
> > value is always the SAME!
>
> Please provide copies of the table and function
> schema.  You've
>  obviously made a mistake in your syntax, but nobody
> can help without
>  specifics.
>
> -Josh
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com

pgsql-novice by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Duplicates Question
Next
From: denis@coralindia.com
Date:
Subject: Re: Duplicates Question