Re: Inconsistant DOW... - Mailing list pgsql-general

From Patrick Welche
Subject Re: Inconsistant DOW...
Date
Msg-id 20040628170201.GJ550@quartz.newn.cam.ac.uk
Whole thread Raw
In response to Inconsistant DOW...  ("W.B.Hill" <bill@hillzaa1.miniserver.com>)
List pgsql-general
On Mon, Jun 28, 2004 at 04:23:25PM +0000, W.B.Hill wrote:
> Hiya!
>
> What's happening, where've I goofed?
>
> CREATE TABLE test (d date);

Try using

  CREATE TABLE test (d timestamp without timezone);

instead..

> SELECT d+'45 days ago'::interval FROM test;
>         ?column?
> ------------------------
>  2004-02-25 23:00:00+00
>  2005-02-10 00:00:00+00
>  2006-03-01 23:00:00+00
>  2007-02-21 23:00:00+00
>  2008-02-07 00:00:00+00
>  2009-02-25 23:00:00+00
>  2010-02-17 23:00:00+00
> (7 rows)
>
> Why the different times??? Why the times???

Different times because of summer time starting before or after Ash
Wednesday, times because of implicit type casting - what is the
type of date + interval ?

> SELECT date_part('dow',d+'45 days ago'::interval) FROM test;
>  date_part
> -----------
>          3
>          4
>          3
>          3
>          4
>          3
>          3
> (7 rows)
>
> So, Ash Wednesday's on a Thursday iff Easter's in March???
> Hmmm.

I'd try adding 46 days ago ;)

Cheers,

Patrick

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Inconsistant DOW...
Next
From: Jan Wieck
Date:
Subject: Slony-I Canada Day Release Candidate available