to_char function returning wrong data - Mailing list pgsql-bugs

From Sreeni Survi
Subject to_char function returning wrong data
Date
Msg-id CAD91y4RLdbXvr+oNoN++Wmn2SjxHYRJZnT95f=BPZcSO0OBTxg@mail.gmail.com
Whole thread Raw
Responses Re: to_char function returning wrong data  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: to_char function returning wrong data  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hi,

Below code has caused my data to be wiped off a table as my where clause depends on the below returned value.

select to_char(current_date - interval '5 weeks','IYYYWW') ;
201953

If the number of weeks is 4 or 6 or 3 it returns correct value.

select to_char(current_date - interval '4 weeks','IYYYWW') ;   
201901

select to_char(current_date - interval '6 weeks','IYYYWW') ;   
201852

This issue can have a serious effect.

Thanks,
Sreeni

pgsql-bugs by date:

Previous
From: Axel Andersson
Date:
Subject: Re: BUG #15608: Index is used for an inherit table but not for thetable with the index
Next
From: Tom Lane
Date:
Subject: Re: BUG #15602: pg_dump archive items not in correct section order