Re: timestamp value

From: Ivan Horvath <pillesoft(at)yahoo(dot)co(dot)uk>
To: pgsql-new <pgsql-novice(at)postgresql(dot)org>
Cc: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Subject: Re: timestamp value
Date: 2002-03-04 09:49:32
Message-ID: 20020304094932.38297.qmail@web14703.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Oliver,

then what can i do -regarding timestamp- if i need to
create such a routine, so called "batch-processing",
which writes data to a table, or more tables at the
same time?
how can i ask the real timestamp value within a stored
procedure?

Ivan

--- Oliver Elphick <olly(at)lfix(dot)co(dot)uk> wrote:
> On Mon, 2002-03-04 at 07:45, Ivan Horvath wrote:
> > Thanks for answer,
> >
> > here is the code of the stored procedure:
> >
> > DROP FUNCTION a_function();
> >
> > CREATE FUNCTION a_function () RETURNS interval AS
> '
>
> In 7.2 you can now do CREATE OR REPLACE FUNCTION...
> rather than DROP
> followed by CREATE.
>
> > 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';
>
>
> All operations within a plpgsql procedure happen
> within a transaction
> and within a transaction current_timestamp does not
> change (by design).
> So each separate call to this procedure will produce
> 10000 identical
> inserts.
>
> --
> Oliver Elphick
> Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
> Isle of Wight
> http://www.lfix.co.uk/oliver
> GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A
> 614D 4C34 3E1D 0C1C
>
> "Give, and it will be given to you. A good
> measure,
> pressed down, taken together and running over,
>
> will be poured into your lap. For with the
> same
> measure that you use, it will be measured to
> you." Luke 6:38
>

__________________________________________________
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 Oliver Elphick 2002-03-04 10:12:58 Re: timestamp value
Previous Message Oliver Elphick 2002-03-04 09:20:02 Re: timestamp value