From: | Alban Hertroys <alban(at)magproductions(dot)nl> |
---|---|
To: | Andrus <kobruleht2(at)hot(dot)ee> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to implement GOMONTH function |
Date: | 2007-05-21 07:53:20 |
Message-ID: | 46514FF0.2070700@magproductions.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Andrus wrote:
> Thank all very much for great suggestions.
>
> I created function
>
> CREATE OR REPLACE FUNCTION PUBLIC.GOMONTH(DATE, INTEGER, OUT DATE)
> IMMUTABLE
> AS
> $_$
> SELECT ($1 + ($2 * '1 MONTH'::INTERVAL))::DATE;
> $_$ LANGUAGE SQL;
>
> I got errors:
>
> function gomonth(date, numeric) does not exist
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.
> function gomonth(date, bigint ) does not exist
Do you really expect to calculate dates over 2 billion months in the
future or the past?
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.
--
Alban Hertroys
alban(at)magproductions(dot)nl
magproductions b.v.
T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede
// Integrate Your World //
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2007-05-21 08:26:06 | Re: Large Database Restore |
Previous Message | Rodrigo De León | 2007-05-21 07:13:10 | Re: doverlaps() returns null |