From: | "Andrus" <kobruleht2(at)hot(dot)ee> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to implement GOMONTH function |
Date: | 2007-05-21 08:39:43 |
Message-ID: | f2rlv6$1lsl$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Alban,
> Why would you want to call the function with a numeric? What does 1.2
> months mean to you? You're probably only interested in the integer part
> of the numeric.
create table test ( m numeric(2) );
select gomonth( current_date, m ) from test;
ERROR: function gomonth(date, numeric) does not exist
Do you think it is bad practice to use the table structure above ?
Do you think that I must use integer instead of numeric(2) and change all my
table structures?
Why numeric(2) is not casted to integer automatically ?
>> function gomonth(date, bigint ) does not exist
>
> Do you really expect to calculate dates over 2 billion months in the
> future or the past?
I really do not want. PostgeSQL wants it.
create table test ( t integer );
select gomonth( current_date, sum(t) ) from test;
ERROR: function gomonth(date, bigint) does not exist
> If you really want to; you can write gomonth versions for numeric and
> bigint month counts with a body that casts the months value to integer
> and calls the gomonth(date, integer) version.
I really want to write only single function version.
Andrus.
From | Date | Subject | |
---|---|---|---|
Next Message | Andrus | 2007-05-21 08:56:33 | Re: FULL JOIN is only supported with merge-joinable join conditions |
Previous Message | Hannes Dorbath | 2007-05-21 08:35:39 | TSearch2 memory usage |