View Single Post

   
  #1 (permalink)  
Old 04-09-2008, 12:39 PM
Ronin
 
Posts: n/a
Default pgsql bug found?

Hi when I do the following function it fills 2 dates per day from 1970
to 2050, except that some months (typical 2 months per year) have 4
dates for one day. this is totally freaky.. I wonder if postgresql is
tripping over itself making a double entry every now and again.

for instance I constantly get the following entries

"2006-10-01 00:00:00"
"2006-10-01 23:59:59.999"
"2006-10-01 00:00:00"
"2006-10-01 23:59:59.999"

Any ideas?

Here the function

DECLARE
yearcnt integer;
monthcnt integer;
daycnt integer;

BEGIN

FOR yearcnt IN 1970..2050 LOOP
monthcnt=1;
FOR monthcnt IN 1..12 LOOP
daycnt = 1;
FOR daycnt IN 1..31 LOOP
insert into datepool values
(to_timestamp(yearcnt||'-'||to_char(monthcnt,'FM00')||'-'||to_char(daycnt,'FM09')||'
00:00:00.000','YYYY MM DD HH24:MI:SS.MS'));

insert into datepool values
(to_timestamp(yearcnt||'-'||to_char(monthcnt,'FM00')||'-'||to_char(daycnt,'FM09')||'
23:59:59.999','YYYY MM DD HH24:MI:SS.MS'));


END LOOP;
END LOOP;
END LOOP;

return;

END;

Reply With Quote