Re: Partial dates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Joe <svn(at)freedomcircle(dot)net>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Partial dates
Date: 2005-09-14 03:50:15
Message-ID: 28925.1126669815@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
>> Any suggestions (aside from designing a new datatype)?

> Well the easy solution is to just make the date a text type but that is
> the wrong answer. The right answer is to fix the data set.
> MySQL should never have allowed you do insert those dates in the first
> place.

I think the right answer is that a new datatype is exactly what you
need. SQL-spec dates are absolutely *not* meant to express these
concepts (and the fact that MySQL allows you to insert "dates" with
zero fields just shows what a lack of error checking they have).

It's really not that hard to build a new datatype in PG, especially
if you only need it to store values and not do any particularly amazing
computational feats. Consider for instance a domain over type "text"
with appropriate constraint checks.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe 2005-09-14 04:09:58 Re: Partial dates
Previous Message Brent Wood 2005-09-14 03:49:29 Re: Partial dates