Re: Dealing with tsvector in fuctions for data split

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Francisco Reyes <lists(at)stringsutils(dot)com>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Dealing with tsvector in fuctions for data split
Date: 2007-08-08 18:28:07
Message-ID: Pine.LNX.4.64.0708082224170.18739@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 8 Aug 2007, Francisco Reyes wrote:

> Francisco Reyes writes:
>
>> ERROR: operator does not exist: text || tsvector

what'd you expect from this operation ? In 8.2 you can cast tsvector
to text like this:

=# select textin( tsvector_out( strip( to_tsvector('1 b c'))))::text || 'some text'::text;
?column?
----------------------
'1' 'b' 'c'some text

You should think about removing positional information from tsvector
using strip() function.

In CVS HEAD standard CAST should works.

postgres=# select cast( 'a b c'::tsvector AS text);
text
-------------
'a' 'b' 'c'

>>
>>> Also, it'd be worth to show simplified version of your function, which
>>> demonstrates your problem.
>>
>>
>> I did include that.
>>
>>>> The function looks like:
>>>> AS $$
>>>> DECLARE
>>>> v_sql TEXT;
>>>> BEGIN
>>>> v_sql := 'INSERT INTO messagecatalog_'||
>>>> to_char(NEW.timestampfield,'YYYY')||
>>>> '(field1, field2) values ('
>>>> ||New.field1||','||New.field2||')
>>>> ')';
>>>> EXECUTE v_sql;
>>>> RETURN NULL;
>>>> END
>>>> $$;
>>
>> In the code above field1 is text and field2 is tsvector.
>
>
> Any suggestions?
> Anyone else has dealt with tsvectors in a partition environment?
> If sow how did you get the split function/rule to insert into the child
> table?
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dann Corbit 2007-08-08 18:38:19 Re: Running a query from the OS CLI
Previous Message Johan Runnedahl 2007-08-08 18:24:04 Installing Postgresql 8.2 on Windows Vista