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

Re: tsearch2 trigger alternative

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: cgg007(at)yahoo(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: tsearch2 trigger alternative
Date: 2004-02-25 13:55:54
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general

Chris Gamache wrote:
> Tsearch2 comes with its own tsearch2 trigger function. You pass column names to
> it, and it puts a vanilla tsvector into the column named in TG_ARGV[0]. Not
> only can you pass column names to it, but you can pass simple functions to it
> as well. This is magical to me. :)
look at tsvector.c:864

numattr = SPI_fnumber(rel->rd_att, trigger->tgargs[i]);
      funcoid = findFunc(trigger->tgargs[i]);
      if (funcoid == InvalidOid)
                  errmsg("could not find function or field \"%s\"",

If current args (trigger->tgargs[i]) isn't a column name, then it's a function 
name. It's simple :)

> I'm trying to figure out how to do the same thing using plpgsql, except instead
> of returning a vanilla tsvector, I want to return a specially weighted
> tsvector. I've created a function that can do this:
I didn't work with plpgsql :(

Teodor Sigaev                                  E-mail: teodor(at)sigaev(dot)ru

In response to


pgsql-general by date

Next:From: cnliouDate: 2004-02-25 14:07:30
Subject: invalid memory alloc request size
Previous:From: cnliouDate: 2004-02-25 13:42:15

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