Skip site navigation (1) Skip section navigation (2)

Trigger using Tsearch

From: "Alexander B(dot)" <burbello3000(at)yahoo(dot)com(dot)br>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Trigger using Tsearch
Date: 2007-03-20 18:47:25
Message-ID: (view raw or flat)
Lists: pgsql-admin
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 '
  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;

' 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.

pgsql-admin by date

Next:From: Karthikeyan SundaramDate: 2007-03-20 19:34:09
Subject: ERROR: invalid byte sequence for encoding "UTF8": 0x92
Previous:From: Tom LaneDate: 2007-03-20 15:25:59
Subject: Re: log localization

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group