Skip site navigation (1) Skip section navigation (2)

Re: Year Only Date Column

From: "Jeff Flowers" <duckfoo(at)fastmail(dot)fm>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Year Only Date Column
Date: 2004-11-23 15:21:04
Message-ID: 1101223264.2680.209293607@webmail.messagingengine.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Tue, 23 Nov 2004 22:28:08 +0900, "Michael Glaesemann"
<grzm(at)myrealbox(dot)com> said:
> 
> On Nov 23, 2004, at 10:16 PM, Jeff Flowers wrote:
> 
> > I want to create a date column that contains only the year, such as
> > YYYY. Can this done in PostgreSQL? I didn't see this listed in the
> > handbook and right now, the only way I can see to do would be to create
> > a numeric data field with zero scale and a precision of four.
> 
> You could do that, or create a domain that would restrict the date to 
> only be, say, CCYY-01-01, which would represent the year.

Since I will be using this column only for the sake of completeness, I
think that I will either use the numeric column (or perhaps a CHAR(4)
column).


Thanks,

-- 
Jeff Flowers

In response to

pgsql-novice by date

Next:From: George WeaverDate: 2004-11-23 16:13:36
Subject: Re: xml2 compile error - work_mem undeclared
Previous:From: Michael GlaesemannDate: 2004-11-23 13:28:08
Subject: Re: Year Only Date Column

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group