[Pgsql-ayuda] Error al ejecutar una funcion....

Gatosoft gatosoft@yahoo.com
Wed, 30 Oct 2002 07:24:27 -0800 (PST)


Hola foro, 

tengo un problema....

Cree una funcion llamada: 

set_novAviso(Numeric, Integer, Integer, varchar)...
etc, que simplemente inserta un registro en una tabla.

la tabla tiene un trigger asociado, (before Insert),
que asigna un consecutivo y establece un valor para
una variable.

el caso es que se compila bien, pero a la hora de
ejecutar la funcion sucede esto:

============================================

nomina=> Select set_novAviso(135, 3, 1, 'S');

fmgr_info: function 38484231 cache lookup faile

nomina=> Select set_novAviso(135, 3, 1, 'S');

poReadData() -- backend closed the channel
unexpectedly. This probably means the backend
terminated abnormally  before or while processing the
request.

The connection to the server was lost. attemping
reset: Failed.
!>
============================================

Aqui les envio la funcion:

===============================================
drop function set_novAviso(Numeric, INTEGER, INTEGER,
Varchar);
create function set_novAviso(Numeric, INTEGER,
INTEGER, Varchar) returns Integer as'
declare
  ano_codigo alias for $1;
  antg_mes Alias for $2;
  antg_dia Alias for $3;
  antg_habilidata Alias for $4;
begin
   insert into novtriggers (no_codigo, ntg_mes,
ntg_dia, ntg_habilidata)
          values (ano_codigo, antg_mes, antg_dia,
antg_habilidata);
Return 0;
end;
' Language 'plpgsql';
============================================
Aqui esta el trigger:

/*Drop sequence seqNovTrigger;*/
/*create sequence seqNovTrigger;*/

Drop function ftgg_NovTrigger();

create function ftgg_NovTrigger() returns Opaque as '
/* Trigger: tgg_NovTrigger*/
begin
    NEW.ntg_consecutivo:=nextval(''seqNovTrigger'');

    if NEW.ntg_habilidata<>''S'' then
       NEW.ntg_habilidata=''N'';
    end if;

    return NEW;
end;
' Language 'plpgsql';

Drop Trigger tgg_NovTrigger On novtriggers;
Create Trigger tgg_NovTrigger Before Insert On
novtriggers
  for each ROW Execute Procedure ftgg_NovTrigger();
================================================

Les agradezco de antemano cualquier ayuda....

PDTA: El problema es solo con esa función.

=====
---------------------------------------
Gatosoft
Bucaramaga/Santander/Colombia
---------------------------------------

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/