On Feb 11, 2008 3:56 AM, Alban Hertroys
<[EMAIL PROTECTED]> wrote:
> On Feb 11, 2008, at 2:23 AM, Willem Buitendyk wrote:
>
> > As others have suggested my big problem with the function I wrote
> > was that I had made it Volatile instead of Immutable (it is no
> > doubt suffering from code bloat as
In response to Alban Hertroys <[EMAIL PROTECTED]>:
> On Feb 11, 2008, at 12:43 AM, brian wrote:
> > Try:
> >
> > CREATE OR REPLACE FUNCTION first_day_next_month(inputdate date)
> > RETURNS date AS
> > $BODY$
> > DECLARE
> > resultdate date;
> > BEGIN
> > SELECT INTO resultdate to_date(to_
On Feb 11, 2008, at 2:23 AM, Willem Buitendyk wrote:
As others have suggested my big problem with the function I wrote
was that I had made it Volatile instead of Immutable (it is no
doubt suffering from code bloat as well). That made all the
difference. Curiously though - I tried it just w
As others have suggested my big problem with the function I wrote was
that I had made it Volatile instead of Immutable (it is no doubt
suffering from code bloat as well). That made all the difference.
Curiously though - I tried it just with the date_trunc function and it
was just as slow as my
On Feb 11, 2008, at 12:43 AM, brian wrote:
Try:
CREATE OR REPLACE FUNCTION first_day_next_month(inputdate date)
RETURNS date AS
$BODY$
DECLARE
resultdate date;
BEGIN
SELECT INTO resultdate to_date(to_char((inputdate + interval \
'1 month'), '-MM') || '-01', '-mm-dd');
Willem Buitendyk wrote:
I have the following function that returns the first day of the next
month from whatever date is inserted. If I use this as part of a select
statement then it takes almost twice as long to perform. Is this
because for each scanned record this function is being called?
Willem Buitendyk <[EMAIL PROTECTED]> writes:
> I have the following function that returns the first day of the next
> month from whatever date is inserted. If I use this as part of a select
> statement then it takes almost twice as long to perform. Is this
> because for each scanned record thi
Willem Buitendyk <[EMAIL PROTECTED]> wrote:
>
> I have the following function that returns the first day of the next
> month from whatever date is inserted. If I use this as part of a select
> statement then it takes almost twice as long to perform. Is this
> because for each scanned record th
On Sun, 10 Feb 2008, Willem Buitendyk wrote:
I have the following function that returns the first day of the next month
from whatever date is inserted.
See if you can do this with date_trunc instead to avoid calling a
function, which avoids the whole thing. The first day of next month is: