Re: proposal: simple date constructor from numeric values

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: simple date constructor from numeric values
Date: 2013-07-01 07:47:46
Message-ID: CAFj8pRAQM-F4pmH5WkoeFNbarWbRPVvdQc=_+=imk2OzKPHWVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

2013/6/29 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> Hello
>
> long time I am thinking about simple function for creating date or
> timestamp values based on numeric types without necessity to create
> format string.
>
> some like ansi_date(year, month, day) and ansi_timestamp(year, month,
> day, hour, minuts, sec, msec, offset)
>
> What do you think about this idea?
I found so same idea was discussed three years ago

http://www.postgresql.org/message-id/14107.1276443739@sss.pgh.pa.us

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

CREATE OR REPLACE FUNCTION construct_date(year int, month int DEFAULT
1, day int DEFAULT 1) RETURNS date;
CREATE OR REPLACE FUNCTION construct_time(hour int DEFAULT 0, mi int
DEFAULT 0, sec int DEFAULT 0, ms float DEFAULT 0.0);
CREATE OR REPLACE FUNCTION construct_timestap(year int, month int DEFAULT ....
CREATE OR REPLACE FUNCTION construct_timestamp_with_timezone(year int,
month int DEFAULT1, ...

???

Regards

Pavel Stehule

>
> Regards
>
> Pavel Stehule

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-07-01 08:01:26 pgsql: Optimize pglz compressor for small inputs.
Previous Message Andres Freund 2013-07-01 07:40:51 Re: plpython implementation