Re: timestamp value

From: Ivan Horvath <pillesoft(at)yahoo(dot)co(dot)uk>
To: pgsql-new <pgsql-novice(at)postgresql(dot)org>
Subject: Re: timestamp value
Date: 2002-03-04 07:45:49
Message-ID: 20020304074549.55032.qmail@web14706.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)agliodbs(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message denis 2002-03-04 08:43:02 Re: Select statement question
Previous Message rob 2002-03-04 04:18:24 committing a type to never change