Thread: Trigger using Tsearch

Trigger using Tsearch

From
"Alexander B."
Date:
Hi for all,

I just installed Tsearch and was trying to configure automatic update on
such table using trigger and procedure.
But I get error on inserting data on the table.
Could you help me to find out what I am wronging?

#### Procedure created:
create or replace function fn_atualiza_tsearch_cid_endereco()
  returns trigger as '
BEGIN
  update tb_cep_cidade_endereco
     set cue_idx_endereco = to_tsvector(''default_portuguese'',
coalesce(to_ascii(NEW.cue_logradouro, ''LATIN1''), ''''))
   where cue_cod_endereco = new.cue_cod_endereco
     and cue_cep = new.cue_cep;

  RETURN NEW;
END;
' LANGUAGE plpgsql;

$ created sucessfully;


#### Trigger created:
create trigger trg_atualiza_tsearch_cid_endereco
  after insert or update on tb_cep_cidade_endereco
  for each row execute procedure fn_atualiza_tsearch_cid_endereco();

$ created sucessfully;


### Insert data
INSERT INTO tb_cep_cidade_endereco . . .

and returns:
>[Error] Script lines: 1-3 --------------------------
 Um erro de E/S ocorreu ao enviar para o processo do servidor.

An error I/O occurred sending to the server process




_______________________________________________________
Yahoo! Mail - Sempre a melhor opção para você!
Experimente já e veja as novidades.
http://br.yahoo.com/mailbeta/tudonovo/