Re: HOW-TO do incomplete dates: year, optional month, optional day?

Will Trillich <will@serensoft.com>

From: will trillich <will@serensoft.com>
To: pgsql-general@postgresql.org
Date: 2003-01-23T20:20:43Z
Lists: pgsql-general
On Thu, Jan 23, 2003 at 11:48:27AM -0600, will trillich wrote:
> On Thu, Jan 23, 2003 at 11:34:27AM +0000, Richard Huxton wrote:
> > On Wednesday 22 Jan 2003 10:11 pm, will trillich wrote:
> > > is there a way, save lots of manual manipulation and
> > > hand-waving, to implement PARTIAL DATES?
> 
> > The only other thing I can think of would be to store it all
> > as an INT4, so for the examples above you'd store
> > 
> > 19910000
> > 19981100
> > 20010517
> > 
> > So you're using the zeroes as n/a but still keeping the value as one column. 
> > Add a check function valid_partial_date(..) and a display fn 
> > show_partial_date(...)
> 
> hey, that's a good idea! or maybe store the year in the first
> two bytes, the month in byte three, and the day in byte four.
> that'd be pretty simple... maybe i should define a new type?
> 
> 	CREATE TYPE partial_date ...

i finally found the xtypes.html on postgresql.org/idocs and it
gives examples of C functions. is it a bad idea to use plpgsql
as the language for creating types?

if so, where do i find the #includes and !gcc command options to
pass so it won't gripe about not finding "main()"?

-- 
There are 10 kinds of people:
ones that get binary, and ones that don't.
 
will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!
 
Looking for a firewall? Do you think smoothwall sucks? You're
probably right... Try the folks at http://clarkconnect.org/ !