Re: proposal: simple date constructor from numeric values - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: proposal: simple date constructor from numeric values
Date
Msg-id 20130703162146.GC3592@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: proposal: simple date constructor from numeric values  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: proposal: simple date constructor from numeric values
Re: proposal: simple date constructor from numeric values
List pgsql-hackers
Peter Eisentraut escribió:
> On 7/1/13 3:47 AM, Pavel Stehule wrote:

> > CREATE OR REPLACE FUNCTION construct_time(hour int DEFAULT 0, mi int
> > DEFAULT 0, sec int DEFAULT 0, ms float DEFAULT 0.0);
> 
> If we are using integer datetime storage, we shouldn't use floats to
> construct them.

I think this is wrong.  Datetime storage may be int, but since they're
microseconds underneath, we'd be unable to specify a full-resolution
timestamp if we didn't have float ms or integer µs.  So either the
seconds argument should allow fractions (probably not a good idea), or
we should have another integer argument for microseconds (not
milliseconds as the above signature implies).

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Add regression tests for ROLE (USER)
Next
From: Robert Haas
Date:
Subject: Re: Add regression tests for COLLATE