problems with function pg_catalog.btrim(date) - Mailing list pgsql-general

From Karina Guardado
Subject problems with function pg_catalog.btrim(date)
Date
Msg-id 4A9706EE.7060600@ues.edu.sv
Whole thread Raw
Responses Re: problems with function pg_catalog.btrim(date)
List pgsql-general
Hi everybody,

I hope some one can help me, I have created  the following function but
I always get the error that there is not function
pg_catalog.btrim(date), in the version postgresql 8.1 it worked but now
it does not so I don't know if it is related with a configuration
problem of the postgresql or somethin in the function code  :

thanks

karina

CREATE FUNCTION edad(date) RETURNS integer
    AS $_$
DECLARE
fechnac ALIAS FOR $1;
dia_nac integer;
mes_nac integer;
anho_nac integer;
fecha_nac  date;
fecha_temp text;
hoy date;
dia  integer;
mes  integer;
anho integer;
temp integer;
edad integer;



BEGIN



hoy := current_date;
hoy := date(trim(hoy));

fecha_nac:= date(trim(fechnac));
fecha_temp:=CAST(fecha_nac  AS  text );


dia_nac :=CAST(substring(fecha_temp from 1 for 2)  AS integer );
mes_nac := CAST (substring(fecha_temp from 4 for 2) AS integer);
anho_nac :=CAST(substring(fecha_temp from 7 for 4) AS integer );


dia :=CAST(substring(hoy from 1 for 2)  AS integer );
mes := CAST (substring(hoy from 4 for 2) AS integer);
anho := CAST(substring(hoy from 7 for 4) AS integer );



edad:= (anho-anho_nac)-1;

IF mes+1-mes_nac < 0  THEN
RETURN edad;
END IF;


IF mes+1-mes_nac < 0  THEN
RETURN edad;
END IF;



IF mes+1-mes_nac > 0  THEN
RETURN edad+1;
END IF;


IF dia-dia_nac >= 0  THEN
RETURN edad+1;
ELSE
RETURN edad;
END IF;
END;

$_$
    LANGUAGE plpgsql;


pgsql-general by date:

Previous
From: Lennin Caro
Date:
Subject: Re: Ungooglable error message when running initdb: Symbol not found: _check_encoding_conversion_args
Next
From: David Fetter
Date:
Subject: Re: [Q] optmizing postgres for 'single client' / many small queries