From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal: simple date constructor from numeric values |
Date: | 2013-07-03 09:23:17 |
Message-ID: | CAFj8pRBV-GvGdHCxi86s8aMvg9pJTT6_iv5=vKqtONU5cA51cw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2013/7/3 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> 2013/7/2 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>> 2013/7/1 Peter Eisentraut <peter_e(at)gmx(dot)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.
>
> I tested this names, and I got a syntax error for function "time"
>
> we doesn't support real type constructors, and parser doesn't respect syntax.
>
> so we can use a different names, or we can try to implement type
> constructor functions.
constructor function - : A niladic SQL-invoked function of which
exactly one is implicitly specified for every structured type. An
invocation of the constructor function for data type
returns a value of the most specific type such that is not null ...
as minimum for Postgres - a possibility to implement function with
same name as type name.
Regards
Pavel
.
>
> Comments
>
> Regards
>
> Pavel
>
>>>
>>
>> +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
From | Date | Subject | |
---|---|---|---|
Next Message | Brendan Jurd | 2013-07-03 10:08:36 | Re: proposal: simple date constructor from numeric values |
Previous Message | Pavel Stehule | 2013-07-03 09:00:06 | Re: proposal: simple date constructor from numeric values |