pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #8672: pg_sleep function doesn't work as expected
2+ messages / 2 participants
[nested] [flat]

* BUG #8672: pg_sleep function doesn't work as expected
@ 2013-12-09 08:29  christophe.nicolas@9online.fr
  0 siblings, 1 reply; 2+ messages in thread

From: christophe.nicolas@9online.fr @ 2013-12-09 08:29 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      8672
Logged by:          M CHRISTOPHE NICOLAS
Email address:      christophe.nicolas@9online.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #8672: pg_sleep function doesn't work as expected
@ 2013-12-09 14:18  Pavel Stehule <pavel.stehule@gmail.com>
  parent: christophe.nicolas@9online.fr
  0 siblings, 0 replies; 2+ messages in thread

From: Pavel Stehule @ 2013-12-09 14:18 UTC (permalink / raw)
  To: christophe.nicolas@9online.fr; +Cc: 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.nicolas@9online.fr>

> The following bug has been logged on the website:
>
> Bug reference:      8672
> Logged by:          M CHRISTOPHE NICOLAS
> Email address:      christophe.nicolas@9online.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2013-12-09 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 08:29 BUG #8672: pg_sleep function doesn't work as expected christophe.nicolas@9online.fr
2013-12-09 14:18 ` Pavel Stehule <pavel.stehule@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox