Question about PARTIAL DATE type/s

From: r d <rd0002(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Question about PARTIAL DATE type/s
Date: 2012-10-07 11:28:24
Message-ID: CALtFtEK35HqMr34hKyyCTV2g522fpiJK+6qAS6rZVdeTWgWS5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have text fields which contains dates in the format 'YYYYMM' (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",'YYYYMM'); -- (a cast won't recognize
the input as valid)

I still get full dates as an output, for example,
'198801' ---> 1988-01*-01*
'196408' ---> 1964-08*-01*
and so on, what is wrong in this case because nowhere it is said that I
have the /first/ of that month, the entry just says that the event in
question happened /during/ that month.

*My question:*
Is it possible to define fields which contain partial dates per above? I
found nothing in the manual.

Thanks,

RD

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniele Varrazzo 2012-10-07 11:59:14 Re: Question about PARTIAL DATE type/s
Previous Message Andreas Kretschmer 2012-10-07 05:46:51 Re: Help with query timeout