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]);
if (numattr == SPI_ERROR_NOATTRIBUTE)
{
funcoid = findFunc(trigger->tgargs[i]);
if (funcoid == InvalidOid)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("could not find function or field \"%s\"",
trigger->tgargs[i])));
continue;
}
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@sigaev.ru