Re: BUG #8672: pg_sleep function doesn't work as expected

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: christophe(dot)nicolas(at)9online(dot)fr
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #8672: pg_sleep function doesn't work as expected
Date: 2013-12-09 14:18:11
Message-ID: CAFj8pRCMQO1DT9rxUwYkfTN4+Y7TaY5M3+tshdkFcwgE+CBx6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

it is not bug

Function now() doesn't show real time - it returns a start of transaction
time

see

begin;
select now();
-- wait some time
select now();
rollback;

probably you would to use clock_timestamp() function

http://www.postgresql.org/docs/9.1/static/functions-datetime.html

Regards

Pavel Stehule

2013/12/9 <christophe(dot)nicolas(at)9online(dot)fr>

> The following bug has been logged on the website:
>
> Bug reference: 8672
> Logged by: M CHRISTOPHE NICOLAS
> Email address: christophe(dot)nicolas(at)9online(dot)fr
> PostgreSQL version: 9.2.2
> Operating system: Windows Seven
> Description:
>
> A simple example :
>
>
> Create Table tst_sleep(instime timestamp);
>
>
> Do '
> Begin
> Insert Into tst_sleep values(Now());
> Perform pg_sleep(5);
> Insert Into tst_sleep values(Now());
> End;
> '
>
>
> Select * From tst_sleep;
> 2013-12-09 09:23:54.012
> 2013-12-09 09:23:54.012
>
>
>
>
> => The Do execution last 5 secondes (ok), but the 2 rows are inserted as
> same time.
>
>
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2013-12-09 14:25:25 Re: BUG #8673: Could not open file "pg_multixact/members/xxxx" on slave during hot_standby
Previous Message petr 2013-12-09 13:47:34 BUG #8673: Could not open file "pg_multixact/members/xxxx" on slave during hot_standby