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

From Pavel Stehule
Subject Re: proposal: simple date constructor from numeric values
Date
Msg-id CAFj8pRC2_ozJjwLY=X8Da1KTo66tNui4wM2P9vs0a1Q-u-mY_Q@mail.gmail.com
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
List pgsql-hackers
2013/7/1 Peter Eisentraut <peter_e@gmx.net>:
> On 7/1/13 3:47 AM, Pavel Stehule wrote:
>> and it is a part of our ToDo: "Add function to allow the creation of
>> timestamps using parameters"
>>
>> so we can have a functions with signatures
>
> I would just name them date(...), time(...), etc.
>

+1

>> CREATE OR REPLACE FUNCTION construct_date(year int, month int DEFAULT
>> 1, day int DEFAULT 1) RETURNS date;
>
> I would not use default values for this one.
>

I have no problem with it

>> 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.
>

so possible signature signature should be

CREATE FUNCTION time(hour int, mi int, sec int, used int) ??

and

CREATE FUNCTION timetz(hour int, mi int, sec int, isec int, tz int)

??

Regards

Pavel



pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: Re: [9.4 CF 1] The Commitfest Slacker List
Next
From: Heikki Linnakangas
Date:
Subject: Re: pgsql_tmp and external sort