Re: proposal: simple date constructor from numeric values

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: simple date constructor from numeric values
Date: 2013-07-01 20:41:49
Message-ID: 51D1E98D.9040309@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

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

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robins Tharakan 2013-07-01 20:59:03 Re: Add regression tests for DISCARD
Previous Message Peter Eisentraut 2013-07-01 20:39:14 Re: Bugfix and new feature for PGXS