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: | 403CA96A.7080706@sigaev.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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]);
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(at)sigaev(dot)ru
From | Date | Subject | |
---|---|---|---|
Next Message | cnliou | 2004-02-25 14:07:30 | invalid memory alloc request size |
Previous Message | cnliou | 2004-02-25 13:42:15 |