Re: Date/time precision in 7.2 - Mailing list pgsql-general

From Thomas Lockhart
Subject Re: Date/time precision in 7.2
Date
Msg-id 3D2C40E8.4FFA5EDC@fourpalms.org
Whole thread Raw
In response to Date/time precision in 7.2  (Steve Lane <slane@fmpro.com>)
List pgsql-general
> A little digging showed that the new date/time formats in 7.2 cause PHP's
> strtotime() function to break.

???

> In the release notes for 7.2 I found this item:
> > Add precision to TIME, TIMESTAMP, and INVERVAL data types (Thomas)
> Which I assume is what's causing PHP the problem -- it doesn't appear to
> like the floating-point representation.

It is a fractional seconds field.

> Question 1: is there a flavor of PGDATESTYLE that makes this representation
> go away? I'm fine with only having accuracy down to the second. I tried the
> listed values for PGDATESTYLE and could not suppress the format that's
> breaking PHP.

No, but you can declare your columns to be of type "timestamp(0)" which
will omit the fractional field.

> Question 2: What exactly does this extra information in the timestamp
> represent? Is it standard, or a postgres extension?

It is SQL9x standard, which requires a default precision on timestamp
and timestamp with time zone of six digits. For some reason it requires
a default precision of zero for time and time with time zone, but I
don't think that data type would solve problems.

Doesn't the PHP strtotime() function work with other database products?
Why wouldn't it trip over those too?

btw, you can modify src/backend/parser/gram.y to change the default
behavior.

                     - Thomas

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.2.1 optimises very badly against 7.2
Next
From: Andrew Sullivan
Date:
Subject: Re: Flag for insentive use of Postgres?