Search Postgresql Archives

Re: Dealing with tsvector in fuctions for data split

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Francisco,

you need to say us standard information about pg version, error message you
got. Also, it'd be worth to show simplified version of your function, which demonstrates your problem.

Oleg
On Mon, 6 Aug 2007, Francisco Reyes wrote:

I am trying to create a function to handle inserts in a database with partitions in a particular table.

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
$$;

The problem I am running into is that one of the fields is a tsvector and when I try to concatenate it wit the rest of the string it gives an error. The only thing I can think of so far is to start a transaction, insert without the tsvector and then do an update to get the tsvector in.

Anyone else had to deal with tsvectors in a fuction?

I am copying some existing data so all the rows already have the tsvector.

If nothing else works I may just not deal with the tsvector in the function and see if I just re-create the tsvector for each record as I am insert the data. ---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

             http://www.postgresql.org/docs/faq


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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux