Re: Partial dates - Mailing list pgsql-general

From Tom Lane
Subject Re: Partial dates
Date
Msg-id 28925.1126669815@sss.pgh.pa.us
Whole thread Raw
In response to Re: Partial dates  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-general
"Joshua D. Drake" <jd@commandprompt.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

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Partial dates
Next
From: Joe
Date:
Subject: Re: Partial dates