[GENERAL] Question about PARTIAL DATE type/s

2012-10-07 Thread r d
Hi, I have text fields which contains dates in the format 'MM' (four positions for the year, two for the month). These fields are contained in text files which I load into the DB. When I convert this field to a date using to_date(PARTIAL_DATE_FIELD,'MM'); -- (a cast won't

Re: [GENERAL] Question about PARTIAL DATE type/s

2012-10-07 Thread Daniele Varrazzo
On Sun, Oct 7, 2012 at 12:28 PM, r d rd0...@gmail.com wrote: Hi, I have text fields which contains dates in the format 'MM' (four positions for the year, two for the month). These fields are contained in text files which I load into the DB. When I convert this field to a date using

Re: [GENERAL] Question about PARTIAL DATE type/s

2012-10-07 Thread Tom Lane
Daniele Varrazzo daniele.varra...@gmail.com writes: Note: it exploits to_date() parsing '200013' as '2001-01', which is reasonable but haven't found documented and don't know how much reliable. Writing a safer one month later function is left as exercise. Consider adding '1 month'::interval

Re: [GENERAL] Question about PARTIAL DATE type/s

2012-10-07 Thread Daniele Varrazzo
On Sun, Oct 7, 2012 at 3:03 PM, Tom Lane t...@sss.pgh.pa.us wrote: Daniele Varrazzo daniele.varra...@gmail.com writes: Note: it exploits to_date() parsing '200013' as '2001-01', which is reasonable but haven't found documented and don't know how much reliable. Writing a safer one month later

Re: [GENERAL] Question about PARTIAL DATE type/s

2012-10-07 Thread r d
I suspected that this would be the answer. Thank you lots for your kind help, Daniele Tom [?] On 7 October 2012 16:46, Daniele Varrazzo daniele.varra...@gmail.comwrote: On Sun, Oct 7, 2012 at 3:03 PM, Tom Lane t...@sss.pgh.pa.us wrote: Daniele Varrazzo daniele.varra...@gmail.com writes: