Re: Dealing with tsvector in fuctions for data split - Mailing list pgsql-general

From Oleg Bartunov
Subject Re: Dealing with tsvector in fuctions for data split
Date
Msg-id Pine.LNX.4.64.0708082224170.18739@sn.sai.msu.ru
Whole thread Raw
In response to Re: Dealing with tsvector in fuctions for data split  (Francisco Reyes <lists@stringsutils.com>)
List 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@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

pgsql-general by date:

Previous
From: "Gauthier, Dave"
Date:
Subject: Running a query from the OS CLI
Next
From: "Dann Corbit"
Date:
Subject: Re: Running a query from the OS CLI