problems with function pg_catalog.btrim(date)

Поиск
Список
Период
Сортировка
От Karina Guardado
Тема problems with function pg_catalog.btrim(date)
Дата
Msg-id 4A9706EE.7060600@ues.edu.sv
обсуждение исходный текст
Ответы Re: problems with function pg_catalog.btrim(date)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Lennin Caro
Дата:
Сообщение: Re: Ungooglable error message when running initdb: Symbol not found: _check_encoding_conversion_args
Следующее
От: David Fetter
Дата:
Сообщение: Re: [Q] optmizing postgres for 'single client' / many small queries