Re: Strange behavior with timestamptz

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "George Weaver" <georgew1(at)mts(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Strange behavior with timestamptz
Date: 2003-08-26 13:08:46
Message-ID: 7688.1061903326@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> ... When the datereceived parameter was defined
> as type Date, it was actually arriving at the procedure as "11-08-2003" and
> "25-08-2003" in spite of showing up as indicated below. When I redefined
> the datereceived parameter as type OdbcDate, it arrived correctly at the
> procedure as "2003-08-11" and "2003-08-25".

Yeah. The first two formats are ambiguous, in Postgres' mind anyway.
With the US datestyle setting, it will first attempt to parse as mm-dd-yyyy
and if that fails try dd-mm-yyyy. So you'd need to change the datestyle
to Euro to get dd-mm-yyyy input to be parsed reliably.

As of 7.4 this is being tightened up, btw --- it'll be mm-dd-yyyy or error.

But AFAICS this has nothing to do with a default now() insertion,
because that value is never converted to a string before it gets into
the stored column.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-08-26 13:09:40 Re: postgres 7.1.3: why does the query plan ignore indexes?
Previous Message George Weaver 2003-08-26 12:28:18 Re: Strange behavior with timestamptz